LuaStateProxy:GetActors
Returns all Actor instances associated with this Lua state.
Syntax
state:GetActors() -> {Actor}Parameters
This method takes no parameters.
Returns
| Type | Description |
|---|---|
{Actor} | Array of Actor instances for this state |
Description
LuaStateProxy:GetActors returns all Actor instances that are associated with this Lua state. For actor states, this will return the actors using that state. For the game state, this will return an empty array.
Example
local state = getluastate()
local actors = state:GetActors()
print("Actors in state:", #actors)
for i, actor in ipairs(actors) do
print(i, actor:GetFullName())
endActor State Example
local actor = Instance.new("Actor")
actor.Parent = workspace
local actorState = getluastate(actor)
local actors = actorState:GetActors()
-- Should contain the actor we just created
for _, a in ipairs(actors) do
print("Actor:", a:GetFullName())
endFilter by State
local allStates = getactorstates()
for _, state in ipairs(allStates) do
if state.IsActorState then
local actors = state:GetActors()
print("State", state.Id, "has", #actors, "actors")
end
endRelated Methods
LuaStateProxy:Execute- Execute code on the stategetluastate- Get state for an actor