Lua states

Before and during the game, many different and completely isolated lua states are created and destroyed.

GUI State

This state has access to all GUI functions, as well as all engine utilities and resources. Commands sent from the GUI will take time to take effect, and the callback will be called many frames after the command has been sent (the command has to first reach and be executed by the engine, which then need to notify the GUI back).

A ".script" will be partially run within this state, in particular all GUI functions run in this state.

Engine State

This is the state where the simulation takes place. The simulation runs an update 5 times per seconds on average. In this state all commands take effect immediately.

A ".script" will be partially run within this state, in particular all non-GUI functions run in this state.

Console State

This state is created at the start of the application and persists until the application is closed. For all intents and purposes it is very similar to the GUI state, and has access to all app and api modules.

postRunFn State

A special state is created just before the game is launched, and runs a postRunFn for each installed and enabled mod. This state is the only one to have write access to the in game resources. Once this state is done with the modifications, the resources will be constant and unmodifiable for the remainder of the game.

Other States

During the loading of the game, many different states are created in order to load all resources in parallel, These "micro states" will run the "runFn" for each mod to ensure modifiers and configurations are applied before loading resources.

generated by LDoc 1.4.3 Last updated 2023-04-18 15:10:38