Fix #52 - Gamestate require init function.

Use __NULL__ when init is not defined in the state.
This commit is contained in:
Matthias Richter 2015-10-13 08:08:26 +02:00
parent 37f4ed9e43
commit f851254f26

View File

@ -40,7 +40,7 @@ local function change_state(stack_offset, to, ...)
local pre = stack[#stack] local pre = stack[#stack]
-- initialize only on first call -- initialize only on first call
;(initialized_states[to] or to.init)(to) ;(initialized_states[to] or to.init or __NULL__)(to)
initialized_states[to] = __NULL__ initialized_states[to] = __NULL__
stack[#stack+stack_offset] = to stack[#stack+stack_offset] = to