Skip to content

Instantly share code, notes, and snippets.

@lancehilliard
Created August 27, 2012 16:37
Show Gist options
  • Save lancehilliard/3490180 to your computer and use it in GitHub Desktop.
Save lancehilliard/3490180 to your computer and use it in GitHub Desktop.
Event.Hook("ClientConnected", InSameFileHandler) not binding...
;game_setup.xml (Step 1):
<game>
<client>ta/Client.lua</client>
<server>ta/Server.lua</server>
</game>
-------------------------------------------------------------------------------------
;ta/Server.lua (Step 2):
Script.Load("lua/Server.lua")
Script.Load("ta/ServerInitialize.lua")
-------------------------------------------------------------------------------------
;ta/ServerInitialize.lua (Step 3):
Script.Load("ta/events/clientConnected.lua")
-------------------------------------------------------------------------------------
;ta/events/clientConnected.lua (Step 4):
Script.Load("ta/ns2/engine.lua")
function OnClientConnected()
Shared.Message("###################################### OnClientConnected() ###")
end
local function BindHandlers()
-- bindHandler is in engline.lua; see below
bindHandler("ClientConnected", OnClientConnected)
end
-- BindHandlers executes when clientConnected.lua (this file) loads...
BindHandlers()
-------------------------------------------------------------------------------------
;ta/ns2/engine.lua (Step 5):
local function InSameFileHandler()
--This line does not appear in my console when I connect...
Shared.Message("###################################### InSameFileHandler() ###")
end
local function bindHandler(eventName, handler)
--Can't get the following line to work...
--Event.Hook(eventName, handler)
--But also can't get /this/ line to work, which has handler in same file
Event.Hook("ClientConnected", InSameFileHandler)
--The following line works. I see it when I connect to my server...
Shared.Message("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment