Lua Environments

From Zero-K
Jump to navigation Jump to search

Environments[edit]

Here is an exhaustive list of the different lua environments within Spring, roughly in execution order as a game is loaded.

LuaMenu[edit]

Source: rts/Lua/LuaMenu.cpp

Introduced in 104.0, a stripped down environment that starts before the game is loaded and persists through reload.

LuaParser[edit]

Source: rts/Lua/LuaParser.cpp

Minimal environment used to parse and load definition files.

LuaIntro[edit]

Source: rts/Lua/LuaIntro.cpp

Introduced in 95.0, to allow visual customisation of the loading process.

LuaRules (synced)[edit]

Source: rts/Lua/LuaHandle.cpp

Source: rts/Lua/LuaHandleSynced.cpp#L305

The main environment for synced game-controlling mechanics ("gadgets").

LuaRules (unsynced)[edit]

Source: rts/Lua/LuaHandle.cpp

Source: rts/Lua/LuaHandleSynced.cpp#L57

The main environment for unsynced game effects, rendering, UI etc. ("gadgets")

LuaGaia (synced)[edit]

Source: rts/Lua/LuaGaia.cpp

As LuaRules (synced) but for maps.

LuaGaia (unsynced)[edit]

Source: rts/Lua/LuaGaia.cpp

As LuaRules (unsynced) but for maps.

LuaUI[edit]

The main environment for toggleable UI elements and controls ("widgets").

Interfaces[edit]

The following table demonstrates which interfaces are available to each environment.

LuaMenu LuaIntro LuaParser LuaRules/Gaia
(synced)
LuaRules/Gaia
(unsynced)
LuaUI
Lua_ConstGame - + - + + +
Lua_ConstEngine + + + + + +
Lua_ConstPlatform + + - - + +
Lua_UnitDefs - - - + + +
Lua_WeaponDefs - - - + + +
Lua_FeatureDefs - - - + + +
Lua_ConstCOB - - - + - -
Lua_CMDs - + - + + +
Lua_UnsyncedRead +*** +*** - - + +
Lua_UnsyncedCtrl +*** +*** - + + +
Lua_SyncedRead - +*** - + + +**
Lua_SyncedCtrl - - - + - -
Lua_MoveCtrl - - - + - -
Lua_PathFinder - - - + + +
Lua_OpenGL_Api +*** +*** - - + +
Lua_GLSL_Api +*** +*** - - + +
Lua_FBO_and_RBO + + - - + +
Lua_UnitRendering - - - - + -
Lua_Fonts + + - - + +
Lua_ConstGL + + - - + +
Lua_VFS + + + +* + +
Lua_Scream + + - - + +
Lua_BitOps - - - + + +
Lua_MathExtra - - - + + +
Lua_Socket + - - - - +


* only VFS.ZIP_ONLY
** with special LOS handling and decoy unit handling
*** stripped down environment with certain functions removed