lua-users home
lua-l archive

Re: Call Lua functions without side effects

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


On 13/06/2008, at 7:31 AM, Nick Gammon wrote:
sandbox = {} -- where to put their stuff
-- load the file, get a function to execute local f = assert (loadfile ("foo.lua"))
-- want to load file into the sandbox table
setfenv (f, sandbox)
My mail program dropped a linefeed, this should clearly read:
-----
sandbox = {} -- where to put their stuff
-- load the file, get a function to execute
local f = assert (loadfile ("foo.lua"))
-- want to load file into the sandbox table
setfenv (f, sandbox)
... and so on ...
- Nick

AltStyle によって変換されたページ (->オリジナル) /