This repository has been archived on 2025-12-11. You can view files and clone it, but cannot push or open issues or pull requests.
UIRP-5M/resources/[system]/runcode/runcode_shared.lua

32 lines
510 B
Lua
Raw Normal View History

2025-02-02 10:40:42 +01:00
local runners = {}
function runners.lua(arg)
local code, err = load('return ' .. arg, '@runcode')
-- if failed, try without return
if err then
code, err = load(arg, '@runcode')
end
if err then
print(err)
return nil, err
end
local status, result = pcall(code)
print(result)
if status then
return result
end
return nil, result
end
function runners.js(arg)
return table.unpack(exports[GetCurrentResourceName()]:runJS(arg))
end
function RunCode(lang, str)
return runners[lang](str)
end