Volt

LuaStateProxy.Id

Unique identifier for this Lua state.

Syntax

state.Id: number

Description

LuaStateProxy.Id is a read-only property that returns a unique numeric identifier for the Lua state. Each state (game state and actor states) has its own unique ID.

Example

local state = getluastate()
print("State ID:", state.Id)

Compare States

local gameState = getgamestate()
local currentState = getluastate()

if gameState.Id == currentState.Id then
    print("Running on game state")
else
    print("Running on different state (ID:", currentState.Id, ")")
end

Track States

local states = getactorstates()
local stateIds = {}

for _, state in ipairs(states) do
    table.insert(stateIds, state.Id)
    print("State ID:", state.Id, "Is Actor:", state.IsActorState)
end

On this page