Is there a way to run a script in a sandbox environment to not pollute global state, but still be able to require"someluafile" in which global vars get set for said environment and NOT the global state
-- main script
local moduleXY = require"moduleXY"
v = 0
moduleXY.setV()
-- moduleXY
local function setV ()
v = 42
end
local moduleXY = {
setV = setV
}
return moduleXY
so that after the call the states v is nil and envs v is set to 42 (instead of state v being 42 and envs 0)
luajit (so 5.1), cpp binding sol3