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.

ContentsxvFunction Arguments <strong>and</strong> Returns 41Converting Celsius to Fahrenheit 41Empty Arguments 42No Return Values 42FunctionsasLuaValues 42Making Decisions with the if Statement 43Simple Conditionals 43Complex Expressions 44Extended Conditionals 44Displaying a Personalized Greeting 45Repeating Actions with the while Statement 46Computing Factorials 46Differences Between while <strong>and</strong> repeat 47Looping with the Numeric <strong>for</strong> Statement 48Computing Factorials 50Evaluation <strong>of</strong> Loop Conditions 50Variable Scope in <strong>for</strong> Loops 50Summary 51Chapter 4 Working with Tables 53Storing Data Using Tables 53<strong>Creating</strong> <strong>and</strong> Indexing Tables 54Clearing an Element from a Table 54Shortcuts <strong>for</strong> String Keys 55<strong>Creating</strong> Populated Tables 55Using Tables as Arrays 56<strong>Creating</strong> an Array 57Getting the Length <strong>of</strong> an Array 57Adding Elements to an Array 58Removing Elements from an Array 60Sorting the Elements <strong>of</strong> an Array 61Using Tables as Namespaces 61<strong>Creating</strong> a Namespace <strong>of</strong> Utility Functions 62Adding Functions to a Namespace 62Storing an Existing Function 62Defining a New Function 63Object-Oriented <strong>Programming</strong> with Tables 63<strong>Creating</strong> a Non-Object-Oriented Counter 63Using Tables as Simple Objects 64Using : to Call Object Methods 65Defining Functions Using : 66Making a Better Counter 67

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

Saved successfully!

Ooh no, something went wrong!