mirror of
https://github.com/citizenfx/cfx-server-data.git
synced 2025-12-12 06:14:09 +01:00
add runcode resource
This commit is contained in:
17
resources/runcode/runcode_shared.lua
Normal file
17
resources/runcode/runcode_shared.lua
Normal 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
|
||||
Reference in New Issue
Block a user