|
Leo Razoumov schrieb:
Potentially I totally missed the point, but if isolation is the problem, what is with (untestet):On 2010-01-09, steve donovan <steve.j.donovan@gmail.com> wrote:(BTW, a safer 5.2 idom is: local loadstring = loadstring in {x = 1, y = 10} do fn = loadstring 'return x + y' end Given that loadstring is potentially a nasty function in a sandbox) steve d.Can one do the following instead? local fn = loadstring 'return x + y' --first compile the chunk for future use in {x = 1, y = 10, print=print} do print(fn()) end -- 11 in {x = 2, y = 20, print=print} do print(fn()) end -- 22 --Leo--
local fn = loadstring ' function(env) do' .. 'return x + y' .. 'end' in {} do print(fn{x = 1, y = 10, print=print}) end -- 11 in {} do print(fn{x = 2, y = 20, print=print}) end -- 22 ? Frank