Skip to content

Instantly share code, notes, and snippets.

@norman
Created July 6, 2009 20:01
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 norman/141646 to your computer and use it in GitHub Desktop.
Save norman/141646 to your computer and use it in GitHub Desktop.
local val = "hello world"
local env = getfenv()
local func = assert(loadstring("print(val)"))
setfenv(func, env)
print(func())
-- expecting "hello world" but get "nil"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment