32 lines
728 B
Plaintext
32 lines
728 B
Plaintext
local intercepts = {}
|
|
|
|
function EA_RegisterScriptCallback(name,func_or_userdata)
|
|
if (func_or_userdata == nil) then
|
|
callstack()
|
|
end
|
|
if not intercepts[name] then
|
|
intercepts[name] = {}
|
|
end
|
|
if (intercepts[name]) then
|
|
intercepts[name][func_or_userdata] = true
|
|
end
|
|
end
|
|
|
|
function EA_UnregisterScriptCallback(name,func_or_userdata)
|
|
if (intercepts[name]) then
|
|
intercepts[name][func_or_userdata] = nil
|
|
end
|
|
end
|
|
|
|
function EA_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
|