lua-users home
lua-l archive

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


David Kastrup wrote:

Incidentally, {...}[i] is not allowed.

It is if you turn the table constructor into a prefixexp by
wrapping it in parentheses:

Lua 5.1.2  Copyright (C) 1994-2007 Lua.org, PUC-Rio
-- Doesn't work:
=(function(...) return {...}[3] end)(nil, nil, "three")
stdin:1: 'end' expected near '['
-- Works:
=(function(...) return ({...})[3] end)(nil, nil, "three")
three

See <http://www.lua.org/manual/5.1/manual.html#8>.

--
Aaron
http://arundelo.com/