getgamestate
Returns the game Lua state.
Syntax
getgamestate() -> LuaStateProxy?Returns
| Type | Description |
|---|---|
LuaStateProxy? | The game state, or nil if it is unavailable |
Description
getgamestate returns a LuaStateProxy for the game state.
Example
local gameState = assert(getgamestate(), "Game state is not available")
print("Game state ID:", gameState.Id)
print("Is Actor State:", gameState.IsActorState) -- falseExecute Code on Game State
local gameState = assert(getgamestate(), "Game state is not available")
gameState:Execute([[
print("Executed on game state!")
]])Compare States
local gameState = assert(getgamestate(), "Game state is not available")
local currentState = getluastate()
if gameState.Id == currentState.Id then
print("Running on game state")
else
print("Running on different state")
endRelated Functions
getluastate- Get LuaStateProxy for a specific actor or scriptgetactorstates- Get all active LuaStateProxy objectsgetactors- Get all Actor instances