lua-users home
lua-l archive

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



On 31/03/2014 17:49, Dirk Laurie wrote:
2014-03-31 22:30 GMT+02:00 Thiago L. <fakedme@gmail.com>:
On 31/03/2014 17:26, Dirk Laurie wrote:
debug.setmetatable("", setmetatable({},{
__index = function(key)
Pretty sure that doesn't work :P
OK, it does not.

    "the access to a metamethod does not invoke other metamethods"

In that case, there is a design reason why this is so, and allowing
a metatable to be replaced by a function would defeat that design.

I don't think the design reason would be "we don't want ppl to sandbox the string metatable so we make it impossible for getmetatable to natively call __metatable if it's a function and also make it impossible to override that behaviour properly without the debug lib"...

So any way to sandbox the string metatable without the debug lib?