add runcode resource

This commit is contained in:
moscovium
2017-09-05 11:58:39 +02:00
parent 2415bad533
commit cbee7d1960
7 changed files with 280 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
function RunCode(code)
local code, err = load(code, '@runcode')
if err then
print(err)
return nil, err
end
local status, result = pcall(code)
print(result)
if status then
return result
else
return nil, result
end
end