(Fix #34) Add callback for returning from push()/pop()

state:resume() will be called on the state that issued a GS.push()
after the pushed state is popped from the stack.
This commit is contained in:
Matthias Richter 2014-08-22 13:42:17 +02:00
parent e10fa66e60
commit bd10ec4caf

View File

@ -57,7 +57,8 @@ function GS.pop()
assert(#stack > 1, "No more states to pop!") assert(#stack > 1, "No more states to pop!")
local pre = stack[#stack] local pre = stack[#stack]
stack[#stack] = nil stack[#stack] = nil
return (pre.leave or __NULL__)(pre) ;(pre.leave or __NULL__)(pre)
return (stack[#stack].resume or __NULL__)(pre)
end end
function GS.current() function GS.current()