mirror of
https://github.com/TangentFoxy/lua-sandbox.git
synced 2025-07-28 02:52:22 +00:00
added refs param
This commit is contained in:
11
README.md
11
README.md
@@ -34,6 +34,17 @@ Usage
|
||||
-- It is also possible to use the env option to add additional variables to the environment
|
||||
sandbox('return foo', {env = {foo = 'This was on the environment'}})
|
||||
|
||||
-- The variables defined on the env are deep-copied and changes on them will not be persisted
|
||||
local env = {foo = "can't touch this"}
|
||||
sandbox('foo = "bar"', {env = env})
|
||||
assert(env.foo = "can't touch this")
|
||||
|
||||
-- If you want to modify variables from inside the sandbox, use the refs option:
|
||||
local refs = {foo = "kindof insecure"}
|
||||
sandbox('foo = "changed"', {refs = refs})
|
||||
assert(refs.foo = "changed")
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
|
Reference in New Issue
Block a user