lua-users home
lua-l archive

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



On Sun, Jul 23, 2017 at 9:39 PM, Mikhail Zajcev wrote:

This can be fixed by making copies of standard library tables, available to user script, in "env"


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

And don't forget to deep copy metatable of file handles too, this metatable is accessible by getmetatable(io.output())