lua-users home
lua-l archive

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



- oprindelig besked -
Emne:	Re: Bug (?) in lua_setmetatable
Fra:	roberto@inf.puc-rio.br (Roberto Ierusalimschy)
Dato:		25-10-2007 15:10

> 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? ...

There is no bug. In Lua 5.0 not all objects have metatables, so
lua_setmetatable returned true when it succeeded. Now in 5.1 all objects
have metatable, so that function never fails. But we thought it was
better not to introduce an incompatibility for such a detail.

-- Roberto