[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua_setmetatable's return type
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 17 Aug 2011 17:15:33 -0300
> A very valid question was raised on #lua this morning.
> Why is lua_setmetatable()'s return type 'int' rather than 'void'?
> My own 10 second scan of the function in the 5.1 source suggests that it can
> only ever return 1 and as such, should probably just be void. This seems to
> remain the case in 5.2-beta
It could return 0 in Lua 5.0, meaning that it could not change the
metatable of the given object (not a table/userdata). Keeping its return
type in 5.1 was one less (smallish) incompatibility. Maybe we can
remove it in 5.2.