getluastate
Resolves a state proxy from an Actor or script.
Syntax
getluastate(target: Actor | BaseScript?) -> LuaStateProxy?
Also available as
get_lua_state
Parameters
| Parameter | Type | Description |
|---|---|---|
target | Actor or BaseScript? | Observed Actor or script; omit for the current context. |
Returns
| Type | Description |
|---|---|
LuaStateProxy? | Resolved proxy, or nil when unavailable. |
Description
Omitting target asks for the current context’s proxy. A script must have an observed state; its name or location alone does not establish one. Unsupported targets raise an error, and an unavailable state can return nil. The proxy does not expose another state’s globals directly.
Example
local actor = getactors()[1]
if actor then
local state = getluastate(actor)
if state then print(state.Id) end
end
These are Game executor contracts. Check build requirements and session lifetimes before using them.
