From 615dd8f111cf9ebb3b3b8e118485d200b5da99e3 Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Mon, 25 Feb 2013 17:51:57 +0100 Subject: [PATCH] Fix gamestate:init() bug, and error on undefined callbacks --- gamestate.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gamestate.lua b/gamestate.lua index db86c4c..91fb44e 100644 --- a/gamestate.lua +++ b/gamestate.lua @@ -35,12 +35,12 @@ function GS.new(t) return t or {} end -- constructor - deprecated! function GS.switch(to, ...) assert(to, "Missing argument: Gamestate to switch to") - current:leave() local pre = current - to:init() + ;(current.leave or __NULL__)(self) + ;(to.init or __NULL__)(to) to.init = nil current = to - return current:enter(pre, ...) + return (current.enter or __NULL__)(current, pre, ...) end -- holds all defined love callbacks after GS.registerEvents is called