init
This commit is contained in:
commit
2fe6ca2f65
1473 changed files with 251771 additions and 0 deletions
47
gamedata/scripts/ixray_system/dynamic_callbacks.lua
Normal file
47
gamedata/scripts/ixray_system/dynamic_callbacks.lua
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
local intercepts =
|
||||
{
|
||||
save = {},
|
||||
load = {},
|
||||
update = {},
|
||||
|
||||
save_state = {},
|
||||
load_state = {}
|
||||
}
|
||||
|
||||
function RegisterScriptCallback(name, func_or_userdata)
|
||||
if (func_or_userdata == nil) then
|
||||
SemiLog("! func_or_userdata == nil")
|
||||
callstack()
|
||||
end
|
||||
|
||||
if (name == nil) then
|
||||
SemiLog("! name == nil")
|
||||
callstack()
|
||||
end
|
||||
if (intercepts == nil) then
|
||||
SemiLog("! intercepts == nil")
|
||||
callstack()
|
||||
end
|
||||
|
||||
if (intercepts[name]) then
|
||||
intercepts[name][func_or_userdata] = true
|
||||
end
|
||||
end
|
||||
|
||||
function UnregisterScriptCallback(name, func_or_userdata)
|
||||
if (intercepts[name]) then
|
||||
intercepts[name][func_or_userdata] = nil
|
||||
end
|
||||
end
|
||||
|
||||
function SendScriptCallback(name,...)
|
||||
if (intercepts[name]) then
|
||||
for func_or_userdata,v in pairs(intercepts[name]) do
|
||||
if (type(func_or_userdata) == "function") then
|
||||
func_or_userdata(...)
|
||||
elseif (func_or_userdata[name]) then
|
||||
func_or_userdata[name](func_or_userdata,...)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue