getcurrentactor
Returns the Actor associated with the current execution context.
Syntax
getcurrentactor() -> Actor?
Also available as
get_current_actor
Returns
| Type | Description |
|---|---|
Actor? | Current Actor, or nil outside an Actor context. |
Description
The main game state has no Actor and returns nil. This does not select another Actor or move the current script into it. Use it inside Actor-submitted code when the code needs to inspect its own context.
Example
local actor = getcurrentactor()
print(actor and actor:GetFullName() or "Main state")
These are Game executor contracts. Check build requirements and session lifetimes before using them.
