返回
· 閱讀時間 2 分鐘
Rune scripting
Rune scripts on nodes, components as fields, a reference read out of a running engine, and completion, hover and linting in the editor.
- Dragos Balaur
Rune is the scripting language. A script is one object per node, and every component on the node is a field it calls.
update(this, dt)runs every frame, andfixed_updateon the fixed step, before physics.exports()returns the defaults. A scene overrides only what it changes, and the inspector lists them per node.- Each component is a field on the node with every function that drives it,
plus
get(),set(),has()andremove(). - The modules, components and assets references are read out of a running engine, and CI fails when they drift.
pub fn exports() {
#{ speed: 2.0 }
}
pub fn fixed_update(this, dt) {
this.node.body2d.apply_impulse(this.speed * dt, 0.0);
}
Tooling

- After
physics2d::completion lists that module, and afternode.body2d.what acts on that component. ⌘Bgoes to a definition,⌘⇧Rrenames across files, and⌥⇧Fformats.- The Problems dock checks on save for a missing script, prefab or asset, and for a shader that will not link.
- A VS Code extension spawns
balaur lsp, which runs the same checks.

balaur checkresolves every component method a script calls against the scene it runs on, and a misspelled one names its file and line.- Findings are warnings, and
--strictmakes them errors for CI.