WoW:API unpack

Revision as of 04:28, 16 July 2007 by WoWWiki>Egingell (It's new)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Returns the values in a table as a list

ret1, ret2, ... retN = unpack(table);

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";

-- As does this:
local arg1 = 1;
local arg2 = 5;
local arg3 = "Hearthstone";

Template:LUA