12.07.2015 Views

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

Wiley-World.of.Warcraft.Programming.A.Guide.and.Reference.for.Creating.WoW.Addons

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 2 ■ Exploring Lua Basics 19The rest <strong>of</strong> the error message is called a stack traceback, which tells youwhere the error occurred. This will be useful when you begin calling functionsfrom other functions.Using History to Make ChangesDepending on the Lua interpreter you are using, you may be able to viewthe recent comm<strong>and</strong>-line history (the last few comm<strong>and</strong>s you’ve given theinterpreter) by pressing the Up <strong>and</strong> Down arrow keys. Test this now bypressing the Up arrow key on your keyboard while in your Lua interpreter.(This always works in WowLua, but may not work correctly if you are usinga st<strong>and</strong>alone version <strong>of</strong> Lua.)If it worked correctly, you should see the last line you typed (prnit(“HelloAzeroth!“)) <strong>and</strong> your cursor should be at the end <strong>of</strong> the line. If it didn’t work,you may instead see something similar to the following:> ˆ [[AThat simply means your specific interpreter doesn’t h<strong>and</strong>le history.Although you may find this inconvenient at times, it certainly shouldn’thamper your capability to run through the examples correctly.Quitting the InterpreterWhen you are done running code in the interpreter, in most cases, you cansimply close the window. However, if you started the interpreter from acomm<strong>and</strong> line <strong>and</strong> want to return to it, you can use one <strong>of</strong> the followingmethods, depending on your operating system.Micros<strong>of</strong>t WindowsOn a Micros<strong>of</strong>t Windows system, Lua can be closed by pressing Ctrl+Z. Thisinserts the following into your interpreter:> ˆ ZIn Windows this inserts a special character that means end-<strong>of</strong>-file, <strong>and</strong> itcauses the interpreter to quit. You can also press Ctrl+C to outright kill yoursession.Mac OS XMac OS X is a UNIX-based system, so the end-<strong>of</strong>-file character is differentfrom that <strong>of</strong> the Windows systems. At your prompt, press Ctrl+D toinsertthe end-<strong>of</strong>-file character <strong>and</strong> end the session immediately. You can also useCtrl+C to kill the session.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!