lua-users home
lua-l archive

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



On 16/04/2014 17:45, Thiago L. wrote:
How about we have a getmetatable(_ENV).__stringmetatable or something?
String metatable sandbox and monkeypatching patch at the same time!
Rephrasing: How about we move the string metatable to _ENV's metatable? That way modules can do their monkeypatching without affecting other ppl's code...

_ENV's metatable would look like this:
setmetatable(_ENV,{
    __stringmt = { -- this is a metafield (like __metatable)
        __index = string
        -- etc
    }
})