Skip to content

Search

Documentation

scene module

The node tree: its root, lookup by path and instancing, plus the component and preset vocabulary an editor's palette lists.

En esta página

The node tree: its root, lookup by path and instancing, plus the component and preset vocabulary an editor's palette lists.

22 functions, 0 constants. Scripts reach it as scene::.

Functions

Argument kinds are the script values a call passes: node is a node handle, any a table or value of any kind, fn a callback.

function acts on what it does
apply_preset(node: node, name: string) — Add every component a preset names to the node; a part that fails leaves the parts before it in place.
bindable_events(node: node?) — Every event a [[nodes.bindings.rows]] row may answer, in the order an editor offers them: the core hooks, and on a node the emitted: events it and its components announce.
binding_actions() — Every action a binding row may do, in the order an editor offers them.
component_expects(name: string) — The components a component type needs something from, for ordering or grouping its sections; nil for a name nothing registered.
component_properties(name: string, params: any) — What a component's apply would receive for params: the schema's defaults with a partial table merged over them. This is how a tool compares two spellings of the same component.
component_schema(name: string) — A component type's property schema as a table; nil for a name nothing registered.
component_tags(name: string) — The facets a component type is filed under, for filtering a palette; nil for a name nothing registered.
component_types() — The names of every registered component type, not the components on any node.
get_node(path: string) — The node at an A/B/C path from the root, where .. climbs to the parent; nil when nothing matches.
instantiate(source: string, parent: node?, opts: any?) — Build a scene document (TOML text, not a path) under a parent; { scripts: false } leaves scripts unattached.
node_by_id(id: string, under: node?) — The node carrying a stable id, which survives the rename and the reparent a path does not; nil when nothing carries it. under bounds the search to one subtree, for a tool holding more than one tree.
preset_info(name: string) — A preset's description, tags, the components it adds, and parts: each component's own properties by name. Nil for a name nothing registered.
presets() — The names of every registered preset.
root() — The tree's root node.
set_variable(name: string, value: any) — Write a scene variable, coerced to the type it was declared with. Every node declaring on_variable_changed hears about it at the end of the tick; writing the value it already holds says nothing.
source(path: string) — A scene file's raw TOML text, project-relative and found inside the pack in a packed run; nil when missing.
switch(path: string, options: map?) — Replace the scene with another one at the end of this tick, so a script asking inside update is not freeing the tree it runs in. fade is seconds the renderer crosses over; reset is a switch to the same file.
tagged(tag: string) — Every node filed under a tag, in tree order; what a scene's tags key and node.add_tag feed.
variable(name: string) — A scene variable's value, or nil for a name nothing declared. A scene declares them under [variables].
variables() — Every declared variable as { name, type, value, persist }, in name order.
warnings(node: node) — What is off about the node, as { component, property, message }: a component missing one it expects, a write its component refused, and what a component says of itself. property is nil for the whole component; advisory only.
with_component(component: string) — Every node carrying the named component, in tree order. What a script asks instead of walking the tree itself.