mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 19:45:22 +09:00
Added module: ExpGamingCore.Commands
This commit is contained in:
@@ -10,7 +10,9 @@
|
||||
--- Runs the given input from the script
|
||||
-- @command interface
|
||||
-- @param code The code that will be ran
|
||||
commands.add_command('interface', 'Runs the given input from the script', {'code',true}, function(event,args)
|
||||
commands.add_command('interface',{'Server.interface-description'}, {
|
||||
['code']={true,'string-inf'}
|
||||
}, function(event,args)
|
||||
local callback = args.code
|
||||
-- looks for spaces, if non the it will prefix the command with return
|
||||
if not string.find(callback,'%s') and not string.find(callback,'return') then callback = 'return '..callback end
|
||||
@@ -28,7 +30,7 @@ commands.add_command('interface', 'Runs the given input from the script', {'code
|
||||
-- runs the function
|
||||
local success, err = Server.interface(callback,false,env)
|
||||
-- if there is an error then it will remove the stacktrace and return the error
|
||||
if not success and is_type(err,'string') then local _end = string.find(err,'stack traceback') if _end then err = string.sub(err,0,_end-2) end end
|
||||
if not success and is_type(err,'string') then local _end = string.find(err,':1:') if _end then err = string.sub(err,_end+4) end end
|
||||
-- if there is a value returned that is not nill then it will return that value
|
||||
if err or err == false then player_return(err) end
|
||||
end)
|
||||
Reference in New Issue
Block a user