WoW:API unpack

Revision as of 08:44, 18 July 2007 by WoWWiki>Tekkub

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"

Template:LUA