local EventHandlers = { OnReadScript = {}, OnShutScript = {}, OnTimerThread = {}, OnLoadInterface = {}, OnInterfaceRender = {}, OnInterfaceActive = {}, OnInterfaceActiveZone = {}, OnPacketRecv = {}, } function BridgeFunctionAttach(eventName, handlerFunction) if EventHandlers[eventName] and type(handlerFunction) == "function" then table.insert(EventHandlers[eventName], handlerFunction) else print(string.format("ADVERTENCIA: Intento de registrar un handler para un evento desconocido o con un handler no vĂ¡lido: '%s'", eventName)) end end function BridgeFunction_OnReadScript() for _, func in ipairs(EventHandlers.OnReadScript) do func() end end function BridgeFunction_OnShutScript() for _, func in ipairs(EventHandlers.OnShutScript) do func() end end function BridgeFunction_OnTimerThread() for _, func in ipairs(EventHandlers.OnTimerThread) do func() end end function BridgeFunction_OnLoadInterface() for _, func in ipairs(EventHandlers.OnLoadInterface) do func() end end function BridgeFunction_OnInterfaceRender() for _, func in ipairs(EventHandlers.OnInterfaceRender) do func() end end function BridgeFunction_OnInterfaceActive() for _, func in ipairs(EventHandlers.OnInterfaceActive) do if func() ~= 0 then return 1 end end return 0 end function BridgeFunction_OnInterfaceActiveZone() for _, func in ipairs(EventHandlers.OnInterfaceActiveZone) do if func() ~= 0 then return 1 end end return 0 end function BridgeFunction_OnPacketRecv(index, head, packet) for _, func in ipairs(EventHandlers.OnPacketRecv) do if func(index, head, packet) ~= 0 then return 1 end end return 0 end