mirror of
https://github.com/vrld/hump.git
synced 2024-11-23 12:24:19 +00:00
Fix gamestate:init() bug, and error on undefined callbacks
This commit is contained in:
parent
63f1cb933d
commit
615dd8f111
@ -35,12 +35,12 @@ function GS.new(t) return t or {} end -- constructor - deprecated!
|
|||||||
|
|
||||||
function GS.switch(to, ...)
|
function GS.switch(to, ...)
|
||||||
assert(to, "Missing argument: Gamestate to switch to")
|
assert(to, "Missing argument: Gamestate to switch to")
|
||||||
current:leave()
|
|
||||||
local pre = current
|
local pre = current
|
||||||
to:init()
|
;(current.leave or __NULL__)(self)
|
||||||
|
;(to.init or __NULL__)(to)
|
||||||
to.init = nil
|
to.init = nil
|
||||||
current = to
|
current = to
|
||||||
return current:enter(pre, ...)
|
return (current.enter or __NULL__)(current, pre, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- holds all defined love callbacks after GS.registerEvents is called
|
-- holds all defined love callbacks after GS.registerEvents is called
|
||||||
|
Loading…
Reference in New Issue
Block a user