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 3 ■ Basic Functions <strong>and</strong> Control Structures 49Table 3-1 explains the different arguments that must be supplied to the <strong>for</strong>statement.Table 3-1: Arguments <strong>for</strong> Numeric <strong>for</strong> LoopARGUMENT DESCRIPTIONvariablename A valid variable identifier, the counter variablestart_valueend_valuestep_valueA number, the initial value <strong>of</strong> variablenameA number, the end value <strong>of</strong> the loopThe number by which to increment the counter after each loopThe following are examples <strong>of</strong> simple <strong>for</strong> loops:> <strong>for</strong> i = 1, 3, 1 do>> print(i)>> end123> <strong>for</strong> i = 3, 1, -1 do>> print(i)>> end321These two loops translate (roughly) to the following code blocks using whileloops:dolocal i = 1while (i = 1) doprint(i)i = i - 1endend

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

Saved successfully!

Ooh no, something went wrong!