Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

prefab.find (procNode)

Look an entity of a prefab up by name: the first record carrying it answers with its id, and found says whether any did. Use it to read the record id another node writes into a component.

Built from prefab.edit (what = "find").

Inputs

  • prefab (Prefab). The prefab searched.
  • name (String, default ""). The entity name looked for. Names may repeat; the first record in order answers.
  • fallback (String, default ""). The id answered when no record carries the name.

Outputs

  • id (String). The record id of the first entity named name, or fallback.
  • found (Bool). Whether a record carries the name.
local car = g.prefab.entity({ prefab = g.prefab.empty({ name = "car" }), name = "wheel" })
local hit = g.prefab.find({ prefab = car, name = "wheel" })
local wheelId, present = hit.id, hit.found