lua-users home
lua-l archive

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



On Tue, Jul 25, 2017 at 8:37 PM, Mikhail Zajcev wrote:

> Yes, deep copy of whole _G into env is a solution.

> Don't forget to create new metatable for strings and set its
> __index field to env.string to prevent user from accessing original
> "string" library as debug.getmetatable"".__index

demo.lua with sandboxing: http://codepad.org/E87tf77T



1) I still can access one of original tables: getmetatable("")
2) _ENV._G == _ENV, it is a "first-level circular references", so _G will not be available?