Expand description
Rust scripting. Scripts are ordinary Rust types compiled into a dynamic library next to the
project and hot-reloaded by the host. Host and library must be built by the same toolchain
from the same engine sources; AbiInfo is checked on load to catch a mismatch early.
Note: statics are duplicated across the library boundary, so scripts must talk to the engine
only through Ctx (that is why logging goes through Ctx::log).
Structs§
- AbiInfo
- Everything that must be identical in the host and in a scripts library for sharing engine memory to be sound: compiler, engine sources, and the layout of the types scripts touch.
- Ctx
- What a script sees each call.
- Script
Def - Exported script factory used by
crate::register_scripts!. - Script
Host - Loaded native script factories. Instances created by this host keep the library loaded even if the host is dropped, so their callback vtables remain valid.
- Script
Lib - Library registration payload; construct through
crate::register_scripts!. - Script
Runtime - Native script instance lifecycle and per-instance panic isolation. A panic disables only the affected instance until it is recreated or reloaded.
- Time
- Simulation time supplied to one script callback.
Enums§
- Phase
- Gameplay callback phase dispatched by
ScriptRuntime.
Traits§
- Script
- Implement this (plus
Default) and list the type inregister_scripts!. Public fields are exposed in the editor by returning them fromfields().
Functions§
- short_
name - Last segment of a type path (
a::b::SpinbecomesSpin); used by [register_scripts!].