engine.get_entities

Shared

Retrieves all registered entities of a specified category


Syntax

local result = engine.get_entities(
    category, 
    streamed = false
)

Parameters

TypeNameDescription
stringcategoryThe entity category to query
booleanstreamedDetermines which entities to include:
• When true - returns only entities currently streamed into the camera frustum
• When false - returns all entities regardless of streaming state

Returns

TypeNameDescription
tableresultA table containing all matching entities of the specified category

Entities

Entity TypeAvailabilityStreamable
"database"Serverfalse
"database_query"Serverfalse
"model"Client | Servertrue
"webview"Clientfalse
"font"Clientfalse
"texture"Clientfalse
"svg"Clientfalse
"rendertarget"Clientfalse
"timer"Client | Serverfalse
"promise"Client | Serverfalse
"thread"Client | Serverfalse

Examples

Prints all entities of a given category
engine.iprint(engine.get_entities("texture"))
Counts entities of a given category
engine.print("info", "Total webviews:", #engine.get_entities("webview"))
Counts only streamed-in models
engine.print("info", "Streamed models:", #engine.get_entities("model", true))

On this page