lua-users home
lua-l archive

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


Hello,

On Aug 03, 2007, at 14:32, Tony Finch wrote:

See paragraph 5 of section 2.8 of the reference manual. Only tables and
userdata have per-value metatables. The other metatables are per-type.

Yes, very unfortunate discrepancy...

That said, now that in Lua 5.1 any object can potentially have its very own metatable, wouldn't it make some kind of sense to drop getfenv and setfenv altogether and extend getmetatable/setmetatable to properly handle functions in addition to tables?

After all, a table metatable or a function environment seems to be very much alike... any reason(s) not to make them the same?

setmetabletable( aFunction, aMetatable ) = setfenv( aFunction, anEnvironment )