trAInsported icon indicating copy to clipboard operation
trAInsported copied to clipboard

"setmetatable" and "getmetatable" are not available

Open marcotc opened this issue 10 years ago • 2 comments

setmetatable and getmetatable global functions are not available for usage in the current sandbox implementation. This makes it harder to create complex programs.

I assume they are absent due to security concerns. I believe that setting the __metatable field in all internal tables should suffice to protect them (see http://www.lua.org/manual/5.1/manual.html#pdf-setmetatable).

I can provide an implementation if this feature is desirable.

marcotc avatar Feb 17 '16 03:02 marcotc

Thanks, Yes, the reason was security. I'm very busy at the moment, so I won't be able to look into this any time soon. If you want the feature in trAInsported, it'd be great if you could provide an implementation!

Germanunkol avatar Feb 17 '16 21:02 Germanunkol

Be sure to sandbox __gc as it runs outside of the debug hooks that limit execution time

pingbird avatar Nov 20 '16 01:11 pingbird