1- require (" ./test2" ){$imports .name .escapedText } = require (" ./test2" )local a = TestClass .new (0 )
1+ require (" ./test2" ){$imports .name .escapedText } = require (" ./test2" )local a = TestClass .new (true , 0 )
22GameState = GameState or {}
33GameState .__index = GameState
4- function GameState .new (...)
4+ function GameState .new (construct , ...)
55 local instance = setmetatable ({}, GameState )
6- if GameState .constructor then GameState .constructor (instance , ... ) end
6+ if construct and GameState .constructor then GameState .constructor (instance , ... ) end
77 return instance
88end
99function GameState .Init (self )
@@ -12,6 +12,7 @@ function GameState.Init(self)
1212 CustomGameEventManager .RegisterListener (CustomGameEventManager ," game_state_request" ,self .OnStateRequest )
1313end
1414function GameState .SetState (self ,state )
15+ local testNil = nil
1516 self .state = state
1617 CustomGameEventManager .Send_ServerToAllClients (CustomGameEventManager ," game_state_update" ,{[" state" ]= self .state })
1718 for _ , callback in ipairs (self .callbacks ) do
2425function GameState .RegisterListenerWithContext (self ,callback ,context )
2526 table.insert (self .callbacks , function (state )
2627 callback (context ,state )
27- end )
28+ end
29+ )
2830end
2931function GameState .OnStateRequest (self ,userid ,event )
3032 local player = PlayerResource .GetPlayer (PlayerResource ,event .PlayerID )
0 commit comments