WoW:API unpack: Difference between revisions
Jump to navigation
Jump to search
m (It's new) |
No edit summary |
||
Line 1: | Line 1: | ||
{{tocright}} | {{tocright}} | ||
Returns the values in a table | Returns the values in a consecutive-integer indexed table | ||
ret1, ret2, ... retN = unpack(table) | ret1, ret2, ... retN = unpack(table) | ||
Will not return values with hash style indexes. For example: | |||
local t = {1, "two", "3", x = "ecks", y = "why?"} | |||
unpack(t) -- returns: 1, "two", "3" | |||
== Arguments == | == Arguments == | ||
Line 11: | Line 15: | ||
== Examples == | == Examples == | ||
local arg1, arg2, arg3 = unpack( | local arg1, arg2, arg3 = unpack({1, 5, "Hearthstone"}) | ||
-- This does the same thing: | -- This does the same thing: | ||
local arg1, arg2, arg3 = 1, 5, "Hearthstone" | local arg1, arg2, arg3 = 1, 5, "Hearthstone" | ||
{{LUA}} | {{LUA}} |
Revision as of 08:44, 18 July 2007
Returns the values in a consecutive-integer indexed table
ret1, ret2, ... retN = unpack(table)
Will not return values with hash style indexes. For example:
local t = {1, "two", "3", x = "ecks", y = "why?"} unpack(t) -- returns: 1, "two", "3"
Arguments
Parameters
- table
- (table) - A table
Returns
- ret1, ret2, ... retN
- A list of the values contained in the given table.
Examples
local arg1, arg2, arg3 = unpack({1, 5, "Hearthstone"}) -- This does the same thing: local arg1, arg2, arg3 = 1, 5, "Hearthstone"