WoW:API pairs: Difference between revisions

48 bytes added ,  15 August 2023
m
Move page script moved page API pairs to WoW:API pairs without leaving a redirect
m (Changed layout slightly, corrected spelling)
m (Move page script moved page API pairs to WoW:API pairs without leaving a redirect)
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Native Lua statement:
{{wowlua}}
Returns an iterator triple that allows for loops to iterate over all key/value pairs in a table.
iteratorFunc, table, startState = pairs(table);


Used in loop constructs to iterate through the values of a table, with index being anything.
== Example ==
 
  local random_array = { mug = "coffee", [42] = "universe", testboolean = false }
Example:
 
  local random_array = { mug = "coffee", [42] = "universe", true = "false" }
   
   
  for index,value in pairs(random_array) do  
  for index,value in pairs(random_array) do  
Line 24: Line 23:
   mug : coffee
   mug : coffee
   42 : universe
   42 : universe
   true : false
   testboolean : false


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