Show raw api
{
"functions": [
{
"name": "entity",
"desc": "A new entity. With `id`, makes that id alive and returns it (the entity of its slot, if\nit has another generation, is deleted).",
"params": [
{
"name": "id",
"desc": "an id to make alive",
"lua_type": "Id?"
}
],
"returns": [
{
"desc": "",
"lua_type": "Entity"
}
],
"function_type": "method",
"source": {
"line": 631,
"path": "src/init.luau"
}
},
{
"name": "component",
"desc": "A new entity with the [mErCS.Component] trait: it can hold data. The first 256 are the\nids 1..256, then any entity id (there is no limit).",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "Component<T>"
}
],
"function_type": "method",
"source": {
"line": 639,
"path": "src/init.luau"
}
},
{
"name": "set",
"desc": "Adds `id` with a value, or replaces the value; [mErCS.OnAdd] or [mErCS.OnChange] runs.\nOnly ids with the [mErCS.Component] trait hold data: setting a value on a tag raises an\nerror.",
"params": [
{
"name": "entity",
"desc": "",
"lua_type": "Id"
},
{
"name": "id",
"desc": "a component or a pair that holds data",
"lua_type": "Id<T>"
},
{
"name": "value",
"desc": "",
"lua_type": "T"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 650,
"path": "src/init.luau"
}
},
{
"name": "add",
"desc": "Adds `id` without a value: a tag, or a component whose value stays nil. Any entity can be\na tag: `local Frozen = world:entity()`.",
"params": [
{
"name": "entity",
"desc": "",
"lua_type": "Id"
},
{
"name": "id",
"desc": "",
"lua_type": "Id"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 659,
"path": "src/init.luau"
}
},
{
"name": "get",
"desc": "The values of up to 8 ids; [World:get_list] takes any number.",
"params": [
{
"name": "entity",
"desc": "",
"lua_type": "Id"
},
{
"name": "...",
"desc": "up to 8 ids",
"lua_type": "Id"
}
],
"returns": [
{
"desc": "the values, nil for a tag or a missing id",
"lua_type": "...any"
}
],
"function_type": "method",
"source": {
"line": 668,
"path": "src/init.luau"
}
},
{
"name": "get_list",
"desc": "The values of any number of ids.",
"params": [
{
"name": "entity",
"desc": "",
"lua_type": "Id"
},
{
"name": "ids",
"desc": "",
"lua_type": "{ Id }"
},
{
"name": "out",
"desc": "the table to fill; a new one when nil",
"lua_type": "{ any }?"
}
],
"returns": [
{
"desc": "",
"lua_type": "{ any }"
}
],
"function_type": "method",
"source": {
"line": 678,
"path": "src/init.luau"
}
},
{
"name": "has",
"desc": "Whether the entity has all of up to 8 ids; [World:has_all] takes any number.",
"params": [
{
"name": "entity",
"desc": "",
"lua_type": "Id"
},
{
"name": "...",
"desc": "up to 8 ids",
"lua_type": "Id"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "method",
"source": {
"line": 687,
"path": "src/init.luau"
}
},
{
"name": "has_all",
"desc": "Whether the entity has all of any number of ids.",
"params": [
{
"name": "entity",
"desc": "",
"lua_type": "Id"
},
{
"name": "ids",
"desc": "",
"lua_type": "{ Id }"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "method",
"source": {
"line": 696,
"path": "src/init.luau"
}
},
{
"name": "remove",
"desc": "Removes `id` from the entity; [mErCS.OnRemove] runs first.",
"params": [
{
"name": "entity",
"desc": "",
"lua_type": "Id"
},
{
"name": "id",
"desc": "a wildcard pair removes every matching pair",
"lua_type": "Id"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 704,
"path": "src/init.luau"
}
},
{
"name": "delete",
"desc": "Removes every id of the entity (their [mErCS.OnRemove] hooks run first), applies the\ncleanup policies of the entity used as an id or a target, and frees the slot. Cascades\nof any depth work (past 100 nested levels the rest is queued).",
"params": [
{
"name": "entity",
"desc": "",
"lua_type": "Id"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 713,
"path": "src/init.luau"
}
},
{
"name": "clear",
"desc": "Removes every id of the entity; the entity stays alive.",
"params": [
{
"name": "entity",
"desc": "",
"lua_type": "Id"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 720,
"path": "src/init.luau"
}
},
{
"name": "contains",
"desc": "Whether the entity is alive. An old handle of a reused slot is not.",
"params": [
{
"name": "entity",
"desc": "",
"lua_type": "Id"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "method",
"source": {
"line": 728,
"path": "src/init.luau"
}
},
{
"name": "exists",
"desc": "Whether the slot of the entity was ever used, also after the delete.",
"params": [
{
"name": "entity",
"desc": "",
"lua_type": "Id"
}
],
"returns": [
{
"desc": "",
"lua_type": "boolean"
}
],
"function_type": "method",
"source": {
"line": 736,
"path": "src/init.luau"
}
},
{
"name": "target",
"desc": "The `index`-th target of the relation on the entity.",
"params": [
{
"name": "entity",
"desc": "",
"lua_type": "Id"
},
{
"name": "relation",
"desc": "",
"lua_type": "Id"
},
{
"name": "index",
"desc": "from 0; the targets are ordered by entity slot",
"lua_type": "number?"
}
],
"returns": [
{
"desc": "",
"lua_type": "Entity?"
}
],
"function_type": "method",
"source": {
"line": 746,
"path": "src/init.luau"
}
},
{
"name": "targets",
"desc": "Iterates the targets of the relation on the entity.",
"params": [
{
"name": "entity",
"desc": "",
"lua_type": "Id"
},
{
"name": "relation",
"desc": "",
"lua_type": "Id"
}
],
"returns": [
{
"desc": "an iterator",
"lua_type": "() -> Entity?"
}
],
"function_type": "method",
"source": {
"line": 755,
"path": "src/init.luau"
}
},
{
"name": "parent",
"desc": "The target of [mErCS.ChildOf] on the entity.",
"params": [
{
"name": "entity",
"desc": "",
"lua_type": "Id"
}
],
"returns": [
{
"desc": "",
"lua_type": "Entity?"
}
],
"function_type": "method",
"source": {
"line": 763,
"path": "src/init.luau"
}
},
{
"name": "children",
"desc": "Iterates the entities that have `(ChildOf, parent)`.",
"params": [
{
"name": "parent",
"desc": "",
"lua_type": "Id"
}
],
"returns": [
{
"desc": "an iterator",
"lua_type": "() -> Entity?"
}
],
"function_type": "method",
"source": {
"line": 771,
"path": "src/init.luau"
}
},
{
"name": "each",
"desc": "Iterates the entities that have `id`.",
"params": [
{
"name": "id",
"desc": "",
"lua_type": "Id"
}
],
"returns": [
{
"desc": "an iterator",
"lua_type": "() -> Entity?"
}
],
"function_type": "method",
"source": {
"line": 779,
"path": "src/init.luau"
}
},
{
"name": "remove_all",
"desc": "Removes `id` from every entity that has it. Without [mErCS.OnRemove] hooks it takes\nabout 20 ns per entity.",
"params": [
{
"name": "id",
"desc": "",
"lua_type": "Id"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 787,
"path": "src/init.luau"
}
},
{
"name": "query",
"desc": "A query over the entities that have all of the given ids (any number; more than 8 go\nthrough a table). See [Query].",
"params": [
{
"name": "...",
"desc": "the ids whose values the query returns",
"lua_type": "Id"
}
],
"returns": [
{
"desc": "",
"lua_type": "Query"
}
],
"function_type": "method",
"source": {
"line": 796,
"path": "src/init.luau"
}
},
{
"name": "added",
"desc": "Connects a listener that runs when `id` is added to an entity. A listener may connect or\ndisconnect listeners, itself included, while it runs: the change applies from the next\nevent.",
"params": [
{
"name": "id",
"desc": "",
"lua_type": "Id<T>"
},
{
"name": "listener",
"desc": "",
"lua_type": "(entity: Entity, id: Id<T>, value: T) -> ()"
}
],
"returns": [
{
"desc": "disconnects the listener",
"lua_type": "() -> ()"
}
],
"function_type": "method",
"source": {
"line": 807,
"path": "src/init.luau"
}
},
{
"name": "changed",
"desc": "Connects a listener that runs when the value of `id` is set again on an entity.",
"params": [
{
"name": "id",
"desc": "",
"lua_type": "Id<T>"
},
{
"name": "listener",
"desc": "",
"lua_type": "(entity: Entity, id: Id<T>, value: T) -> ()"
}
],
"returns": [
{
"desc": "disconnects the listener",
"lua_type": "() -> ()"
}
],
"function_type": "method",
"source": {
"line": 816,
"path": "src/init.luau"
}
},
{
"name": "removed",
"desc": "Connects a listener that runs before `id` is removed from an entity; `deleting` is true\nwhen the entity itself is being deleted.",
"params": [
{
"name": "id",
"desc": "",
"lua_type": "Id<T>"
},
{
"name": "listener",
"desc": "",
"lua_type": "(entity: Entity, id: Id<T>, deleting: boolean?) -> ()"
}
],
"returns": [
{
"desc": "disconnects the listener",
"lua_type": "() -> ()"
}
],
"function_type": "method",
"source": {
"line": 826,
"path": "src/init.luau"
}
},
{
"name": "track",
"desc": "Starts recording additions, value changes and removals of `id` per tick, for the change\nfilters [Query:added], [Query:changed] and [Query:removed]. Untracked ids cost nothing; a\ntracked id costs a call per add, change or remove.",
"params": [
{
"name": "id",
"desc": "",
"lua_type": "Id"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 835,
"path": "src/init.luau"
}
},
{
"name": "tick",
"desc": "Advances the tick: the changes recorded so far become visible to change filters. Call it\nonce per frame.",
"params": [],
"returns": [
{
"desc": "the new tick",
"lua_type": "number"
}
],
"function_type": "method",
"source": {
"line": 843,
"path": "src/init.luau"
}
},
{
"name": "range",
"desc": "The entity ids of this world start at `first` and stay below `last` (networked worlds).",
"params": [
{
"name": "first",
"desc": "",
"lua_type": "number"
},
{
"name": "last",
"desc": "",
"lua_type": "number?"
}
],
"returns": [],
"function_type": "method",
"source": {
"line": 851,
"path": "src/init.luau"
}
},
{
"name": "column",
"desc": "The value pages of a component, for the fast path of [Query:spans]: the value of a slot\nis `column[slot // PAGE_SIZE + 1][slot % PAGE_SIZE + 1]`.",
"params": [
{
"name": "id",
"desc": "",
"lua_type": "Id"
}
],
"returns": [
{
"desc": "the value pages",
"lua_type": "{ { any } }"
}
],
"function_type": "method",
"source": {
"line": 860,
"path": "src/init.luau"
}
},
{
"name": "alive_table",
"desc": "The entity of every slot, for the fast path: `alive_table()[slot]`. A free slot holds a\nnegative number.",
"params": [],
"returns": [
{
"desc": "",
"lua_type": "{ number }"
}
],
"function_type": "method",
"source": {
"line": 868,
"path": "src/init.luau"
}
},
{
"name": "ids",
"desc": "Every id of the entity (components, tags, pairs), sorted ascending.",
"params": [
{
"name": "entity",
"desc": "",
"lua_type": "Id"
}
],
"returns": [
{
"desc": "",
"lua_type": "{ Id }"
}
],
"function_type": "method",
"source": {
"line": 876,
"path": "src/init.luau"
}
}
],
"properties": [],
"types": [],
"name": "World",
"desc": "A world holds entities and the components, tags and pairs on them. [mErCS.world]\ncreates one.\n\nEvery component, tag and pair keeps a bitset of the entities that have it, and the\nvalues of a component sit in pages indexed by the entity slot: adding or removing an id\nsets a bit and a value and never moves the entity.",
"source": {
"line": 622,
"path": "src/init.luau"
}
}