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

@@ -69,6 +69,7 @@ end
Manager.verbose = function(rtn,action)
local settings = Manager.setVerbose
local state = Manager.currentState
if Manager.error and state == Manager.error.__crash then return end
-- if ran in a module the the global module_name is present
local rtn = type(rtn) == table and serpent.line(rtn) or tostring(rtn)
if module_name then rtn='['..module_name..'] '..rtn
@@ -341,6 +342,7 @@ Manager.loadModules = setmetatable({},
-- @usage #Manager.error -- returns the number of error handlers that are present
-- @usage pairs(Manager.error) -- loops over only the error handlers handler_name,hander
Manager.error = setmetatable({
__crash=false,
__error_call=error,
__error_const={},
__error_handler=function(handler_name,callback)
@@ -400,7 +402,7 @@ Manager.error = setmetatable({
local function next_pair(tbl,k)
local v
k, v = next(tbl, k)
if k == '__error_call' or k == '__error_const' or k == '__error_handler' then return next_pair(tbl,k) end
if k == '__error_call' or k == '__error_const' or k == '__error_handler' or k == '__crash' then return next_pair(tbl,k) end
if type(v) == 'function' then return k,v end
end
return next_pair, tbl, nil
@@ -437,6 +439,7 @@ Manager.event = setmetatable({
},{
__metatable=false,
__call=function(tbl,event_name,new_callback,...)
if Manager.error.__crash then Manager.error.__error_call('No error handlers loaded; Game not loaded; Forced crash: '..tostring(Manager.error.__crash)) end
-- if no params then return the stop constant
if event_name == nil then return rawget(tbl,'__stop') end
-- if the event name is a table then loop over each value in that table