Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit44fd9e59bd

README.md

entityOps.addComponents

Attach component(s) — with their setup data — to one or many entities in a single call, creating the entities first when asked.

entityOps.addComponents("crate", { Physics = { kind = "dynamic" } })
entityOps.addComponents({ "crate_1", "crate_2" }, { "Physics", "Audio" })
entityOps.addComponents("spinner", { Rotator = { speed = 2 } }, { create = true })

Targets are entity names or ids (arrays and scene.find results pipe straight in). Components are a name, an array of names, or a { Name = dataTable } map carrying each component's setup data — names accept the leaf ("Physics"), the full identity ("@builtin::components.Physics"), or a VFS path, resolved before anything mutates.

create = true spawns a fresh root entity for any string target that matches nothing, so one call both creates the entity and gives it its setup. Returns one { id, name, added, created? } record per entity.