WoW:API pairs: Difference between revisions

{{luaapi}}
(a string can not be called true! and it wasn't a boolean.)
({{luaapi}})
Line 1: Line 1:
Native Lua statement:
{{luaapi}}
 
Returns an iterator triple that allows for loops to iterate over all key/value pairs in a table.
Used in loop constructs to iterate through the values of a table, with index being anything.
iteratorFunc, table, startState = pairs(table);
 
Example:


== Example ==
  local random_array = { mug = "coffee", [42] = "universe", testboolean = false }
  local random_array = { mug = "coffee", [42] = "universe", testboolean = false }
   
   
Line 27: Line 26:


would be output to the chat window.
would be output to the chat window.
{{LUA}}