LuaStateProxy.new
Gets a LuaStateProxy for the current Lua state.
Syntax
LuaStateProxy.new() -> LuaStateProxy?Parameters
This function takes no parameters.
Returns
| Type | Description |
|---|---|
LuaStateProxy? | The current state, or nil if it is unavailable |
Description
LuaStateProxy.new returns a proxy for the current Lua state.
Example
-- Create a proxy for the current state
local state = assert(LuaStateProxy.new(), "Current state is unavailable")
print("State ID:", state.Id)
print("Is Actor State:", state.IsActorState)Get Current State
local state = assert(LuaStateProxy.new(), "Current state is unavailable")
-- Access state properties
print("State ID:", state.Id)
-- Execute code on this state
state:Execute([[
print("Executed on current state!")
]])Related Functions
getluastate- Get LuaStateProxy for an actor or scriptgetgamestate- Get the default game Lua stateLuaStateProxy:Execute- Execute code on the state