Engine

core.engine.get_entities

Shared

Retrieves all registered entities of a specified category

Syntax

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

Parameters

TypeNameDescription
stringcategoryEntity category to query
Refer Entity Types section
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

Entity Types

CategoryAvailabilityStreamableDimensionNotes
core.modelclient | server✓✓Frustum-culled
core.cameraclient—✓Selects the dimension it renders
core.webviewclient——
core.fontclient——
core.imageclient——
core.svgclient——
core.rendertargetclient——
core.displayclient——
core.shaderclient——
core.audio_2dclient——
core.audio_3dclient✓✓Frustum-culled positional audio
core.databaseserver——
core.db_queryserver——
util.timerclient | server——
util.promiseclient | server——
util.threadclient | server——
light.directionalclient✓✓Always streamed
light.pointclient✓✓Frustum-culled
light.spotclient✓✓Frustum-culled
light.areaclient✓✓Frustum-culled
particle.gpuclient✓✓Frustum-culled
particle.trailclient✓✓Frustum-culled
physics.rigidclient | server✓✓Frustum-culled
physics.staticclient | server✓✓Frustum-culled
physics.characterclient | server✓✓Frustum-culled
physics.animatableclient | server✓✓Frustum-culled
physics.vehicleclient | server✓✓Frustum-culled
physics.vehicle_wheelclient | server✓✓Frustum-culled, follows its parent's dimension
physics.areaclient | server—✓
physics.collision_shapeclient | server✓✓Frustum-culled, follows its parent's dimension

Examples

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

On this page