WoW:API unpack: Difference between revisions

m
Move page script moved page API unpack to WoW:API unpack without leaving a redirect
({{luaapi}})
m (Move page script moved page API unpack to WoW:API unpack without leaving a redirect)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{luaapi}}
{{wowlua}}
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:
  local t = {1, "two", "3", x = "ecks", y = "why?"}
  local t = {1, "two", "3", x = "ecks", y = "why?"}
  unpack(t) -- returns: 1, "two", "3"
  unpack(t) -- returns: 1, "two", "3"


== Arguments ==
== Arguments ==
;table: (table) - A table
;table
;start: Integer - Starting index, defaults to 1 if nil
: (table) - A table
;end: Integer - Ending index, appends nil values if the table does not contain enough
;start
: Integer - Starting index, defaults to 1 if nil
;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 ==
Anonymous user