WoW:API unpack: Difference between revisions

32 bytes removed ,  25 March 2010
{{luaapi}}
m (→‎Notes: I R has gud grammar...)
({{luaapi}})
Line 1: Line 1:
{{tocright}}
{{luaapi}}
Returns the values in a consecutive-integer indexed table
Returns the values in a consecutive-integer indexed table
  ret1, ret2, ... retN = unpack(table[, start][, end])
  ret1, ret2, ... retN = unpack(table[, start [, end]])


Will not return values with hash style indexes.  For example:
Will not return values with hash style indexes.  For example:
Line 8: Line 8:


== Arguments ==
== Arguments ==
=== Parameters ===
;table: (table) - A table
:;table: (table) - A table
;start: Integer - Starting index, defaults to 1 if nil
:;start: Integer - Starting index, defaults to 1 if nil
;end: Integer - Ending index, appends nil values if the table does not contain enough
:;end: Integer - Ending index, appends nil values if the table does not contain enough


=== Returns ===
=== Returns ===
:;ret1, ret2, ... retN: A list of the values contained in the given table.
;ret1, ret2, ... retN : A list of the values contained in the given table.


== Examples ==
== Examples ==
Line 46: Line 45:
   t[5] = 1
   t[5] = 1
   print(unpack(t))  -- prints 1 even though it's the same contents as in Notes Example 2.
   print(unpack(t))  -- prints 1 even though it's the same contents as in Notes Example 2.
{{LUA}}