Builtin Library
- ..
- README.md1.8 KB
- init.luau38.2 KB
- members.module
- ref.module
README.md
entity
The entity global: spawning, despawning, finding, and the reference you get
back when you call it.
entity is a table you can also call. entity.spawn(...) and its siblings act
on the scene; entity(id) hands back an entityRef — the per-entity surface
carrying .position, .component, :despawn() and the rest.
local id = entity.spawn("Crate")
local e = entity(id)
e.position = { 0, 1, 0 }
e.component.add("Model", { mesh = "@builtin::meshes.cube" })
What lives here
| File | What it is |
|---|---|
init.luau | The entity global — typed wrappers over the Internal __entity namespace, plus the coercions and entity.hierarchy. |
members.module/ | The entityRef's member set: every member's kind, type and description, in one table. |
ref.module/ | The entityRef metatable — what entity(id) returns and how a member access dispatches. |
Where the entityRef's surface is defined
members.module is the single description of it. The runtime's accepted-member
set derives from that table, the LSP's entityRef type is generated from it,
and each member's documentation is published from it. Nothing describes the
entityRef anywhere else — a second description could only drift from this one.
To add a member: declare it in members.module with its kind, type and
doc, and implement it in ref.module. A member missing from the table is
refused by the runtime; a member in the table with no implementation answers
nil.
Related
entity.hierarchy— swap a blockout entity for a generated asset.ecs.*— the ECS storage surface. ECS components are not script components;entity(id).componentis the script-component surface and the two are separate systems.