Added module: ExpGamingCore.Commands

This commit is contained in:
Cooldude2606
2018-06-05 19:32:29 +01:00
parent 6272e29606
commit 9be85f04a6
31 changed files with 686 additions and 289 deletions

View File

@@ -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)