baochungitdefold-wrap
baochungit/defold-wrap/wrap.node_list
Wraps several GUI nodes at once. new takes node ids, or names paired with ids or
nodes, and returns a table holding one wrap.node wrapper per name, optionally looking
each id up in a cloned tree first.
- GitHub: baochungit/defold-wrap — pinned to
1.1.0- Pick a release from baochungit/defold-wrap releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as node_list from "wrap.node_list"
- Pick a release from baochungit/defold-wrap releases and add its Source code (zip) URL (or a packaged
Functions
new(2 overloads): NodeList<K>
<const K extends string>(data: readonly K[], tree?: NodeTree)Wraps the node with each id, keyed by the id.
Parameters
data:readonly K[]— The node ids.tree?:NodeTree— A table fromgui.clone_treeorgui.get_treeto look each id up in first. An id it lacks, or every id when it is omitted, is looked up withgui.get_node.
<K extends string>(data: Record<K, string | Opaque<'node'>>, tree?: NodeTree)Wraps each node, keyed by its name. A Lua table mixing ids and named entries has no TypeScript literal, so name every entry, an id under its own name.
Parameters
data:Record<K, string | Opaque<'node'>>— Each name, paired with a node id or a node.tree?:NodeTree— A table fromgui.clone_treeorgui.get_treeto look each id up in first. An id it lacks, or every id when it is omitted, is looked up withgui.get_node.
Returns
NodeList<K>