Current way to define a new state is something like:
local menustate = setmetatable({}, {__index = gamestate})
local mt = {__index = menustate}
function menustate.new()
return setmetatable({}, mt)
end
function menustate:draw()
-- draw the menu here
end
Lines 1-2 should be collapsed into something like local menustate = gamestate.extend(). A default menustate constructor could also be provided, though I'm not sure how useful it would be. Typically states need some data associated with them.
Current way to define a new state is something like:
Lines 1-2 should be collapsed into something like
local menustate = gamestate.extend()
. A defaultmenustate
constructor could also be provided, though I'm not sure how useful it would be. Typically states need some data associated with them.