Skip to content

Instantly share code, notes, and snippets.

@tst2005
Created November 19, 2015 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tst2005/f6cb49e115671373eb61 to your computer and use it in GitHub Desktop.
Save tst2005/f6cb49e115671373eb61 to your computer and use it in GitHub Desktop.
safe bytecode, unsafe reusable
local bytecode
do
local A="a"
local f1 = function()
return A
end
bytecode = string.dump(f1)
end
local env = {}
local f2 = load(bytecode, "", "b", env)
print( f2() == env) -- true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment