mirror of
https://github.com/kikito/lua-sandbox.git
synced 2024-12-18 03:04:20 +00:00
cleanup
This commit is contained in:
parent
57a914f082
commit
3a90dc3319
@ -76,19 +76,14 @@ local function run(f, options)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
debug.sethook(timeout, "", step)
|
debug.sethook(timeout, "", step)
|
||||||
|
|
||||||
string.rep = nil
|
string.rep = nil
|
||||||
|
|
||||||
local ok, result = pcall(f)
|
local ok, result = pcall(f)
|
||||||
|
|
||||||
cleanup()
|
cleanup()
|
||||||
|
|
||||||
if not ok then error(result) end
|
if not ok then error(result) end
|
||||||
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
local sandbox = { run = run }
|
return setmetatable({run = run}, {__call = function(_,f,o) return run(f,o) end})
|
||||||
|
|
||||||
|
|
||||||
return setmetatable(sandbox, {__call = function(_,f,o) return run(f,o) end})
|
|
||||||
|
Loading…
Reference in New Issue
Block a user