lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Rena, you should check out the "Unpack Tables by Name" patch over on the Power Patches page (

I have not patched my Lua with this patch yet, however, it looks like it would do exactly what you desire; namely let you assign locals to the result of table key lookups in a concise manner!

From the Power Patches page:

Enhancement to the assignment statement to unpack named values from tables using the in keyword:
    local a, b, c in some_table_expression

Is syntactic sugar for:
    local t = some_table_expression
    local a, b, c = t.a, t.b, t.c


On Nov 17, 2013, at 2:37 AM, Rena <> wrote:

> But the point to understand is that this must be a purely _static_
> operation at compile time. So implementing something like 'using
> table.*' hits the problem of determining the contents of 'table' at
> compile time.  So it would have to be an explicit list of entries to
> localize, and understood as syntactical sugar for all those pesky
> 'local insert = table.insert' statements.