GameState table

I remember seeing a way to keep track of game states in a table, but can’t seem to find it. Could anyone give me a link or example? Thanks

Heres one I wrote about

Just make a class for each state, and put them in a table:

states = {
    menu = Menu(),
    game = Game(),

Then make a state variable that stores which state is the current one. So you could do state = "game" to set it to the game state.

In draw, touched, etc. just use something like

function draw()

Thanks, that’s exactly what I was looking for SkyTheCoder

I found this scene manager example to be HUGELY helpful to me:

It really helped me organise the game I’m working on.