Skip to content

Instantly share code, notes, and snippets.

@red-001
Last active January 3, 2018 21:52
Show Gist options
  • Save red-001/292a2b52ee18b4a92e02599b4b245674 to your computer and use it in GitHub Desktop.
Save red-001/292a2b52ee18b4a92e02599b4b245674 to your computer and use it in GitHub Desktop.
local function run(user_mod_code)
local env = table.copy(_G)
local user_function, message = loadstring(user_mod_code)
if not user_function then return nil, message end
setfenv(user_function, env)
return pcall(user_function)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment