no edit summary
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}} | ||