lua-users home
lua-l archive

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


> Btw, "local t = {n = n}, mt" looks wrong.
>
> Question: should Lua issue an error if there are
>           more expressions than variable names?

It doesn't do what it probably was intended to do, however it is perfectly
OK Lua syntax. The extra values - in this case the value of the global mt
(probably nil) - will be discarded.

For the author of the original code: you probably want to rewrite that line
as follows:
local mt, t = {}, {n = n}
or better yet, separate the declaration of locals with initialization from
the ones without initialization
local mt
local t = {n = n}

Marius Gheorghe
Software Group Leader
CableTest Systems Inc.
Cable testing, wire testing, backplane testing, connector testing
specialists
phone: +1 (905) 475-2607 / X234
email: mgheorghe@cabletest.com
web: www.cabletest.com