lua-users home
lua-l archive

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


> the lua_setmetatable() function returns an int, which is used in one
> other place in the Lua source; the return value is however always 1.
>
> Is the "always return 1" a bug in lua_setmetable()? Is the non-void
> return value the bug? ...

The 1 indicates that there is a single value on the stack, namely the
table that was passed in as the first argument.  This allows for the
following:

local obj = setmetatable({}, mt)

As far as I am aware.