1
0
mirror of https://github.com/citizenfx/cfx-server-data.git synced 2026-05-14 09:25:33 +08:00

runcode: improved UI, in-game support, JS support

This commit is contained in:
blattersturm
2019-10-21 15:04:55 +02:00
Unverified
parent 64a26ad1de
commit 54f75bca86
10 changed files with 702 additions and 57 deletions
+19 -4
View File
@@ -1,5 +1,12 @@
function RunCode(code)
local code, err = load(code, '@runcode')
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)
@@ -11,7 +18,15 @@ function RunCode(code)
if status then
return result
else
return nil, 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