ReferenceActors

getactorfromthread

Names the Actor that owns the running code.

Syntax

getactorfromthread(thread: thread) -> Actor?

Parameters

ParameterTypeDescription
threadthreadA thread, usually coroutine.running().

Returns

TypeDescription
Actor?The Actor the code is running in, or nil outside an Actor.

Description

Inside an Actor it answers with that Actor whatever thread is passed. In the main game state it answers nil. A non-thread argument raises an error.

Example

print(getactorfromthread(coroutine.running()))

These are Game executor contracts. Check build requirements and session lifetimes before using them.