As far as I know, Defold doesn’t have a built-in option for FSMs, and you would have to import a lua module like this one to get one working.
The problem is, I want to use some kind of manager object to manage game state for a turn based game, and allow other objects to get and set information on that object. My first thought was to use go.property() to set a property that held the state machine, but the modules I found create FSMs by returning a lua table, which cannot be passed into go.property().
Is there another way to do this? Or should I be using a different method for game state entirely?
I can recommend you Oyster available here in Assets portal I’m using it in my project and every object that want to know anything about a game can require modules from Oyster and set/get state or any other data.
What do you mean by this exactly? From what I understand, you can only access properties from other scripts using go.property() and go.get(). The former doesn’t allow you to pass in a Lua table.
Each script file can define local variables that are local to the script. Each script component sharing the same script file will share the local variable.
Global variables are shared between any script that are part of the same lua context. If you set the “Shared State” setting in “game.project” all scripts (gui, render and game object component scripts) will share the same context and thus share the same globals.