function stateMenu() local items = {"play", "rules"} local selected = 1 local buttons = { makeButton(10, 10, 30, 6, "play", function() setState(states.game) end, function() selected = 1 end), makeButton(10, 20, 30, 6, "rules", function() setState(states.rules) end, function() selected = 2 end) } function _enter() end return { _enter = _enter, _update = function() for button in all(buttons) do button:update() end end, _draw = function() for k,button in ipairs(buttons) do button:draw(selected == k) end end } end