Expand description
§bevy_scripting_rune
Simple integration of rune for bevy.
§Compatibility
| bevy | bevy_scripting_rune |
|---|---|
| 0.18 | 0.6 |
| 0.17 | 0.5 |
| 0.16 | 0.2-0.4 |
| 0.15 | 0.1 |
§Example
use bevy::prelude::*;
use bevy_scripting_rune::prelude::*;
fn setup(
asset_server: Res<AssetServer>,
script_assets: Res<Assets<bevy_scripting_rune::Script>>,
mut executor: ResMut<bevy_scripting_rune::Executor>,
)
{
let handle = asset_server.load("test.rn");
let script = script_assets.get(&handle).unwrap();
executor.load_script(script);
executor.build().unwrap();
}
fn run(executor: Res<bevy_scripting_rune::Executor>)
{
let r = executor.call::<i32>("plus", (38, 4)).unwrap();
println!("r = {}", r);
}
fn main()
{
App::new()
.add_plugins((
DefaultPlugins,
DefaultScriptingRunePlugin::default(),
))
.add_systems(Startup, setup)
.add_systems(Update, run);
}
A more complex example is available in example/example.rs.
Re-exports§
pub use rune;
Modules§
- prelude
- Important types to conveniently import.
- protocol
- protocol module for communication between game and rune scripts.
- value
- Value module.
Structs§
- Executor
- Executor resource to run scripts.
- Script
- Script asset for a rune script.
- Scripting
Rune Plugin - Plugin for adding support to scripting with rune. TGameMessage is the type used to send messages from the Game to listeners writen in Rust. TScriptMessage is the type used to send messages from Rust scripts to the Game. Usage
Type Aliases§
- Default
Scripting Rune Plugin - Plugin for adding support to scripting with rune. Using dummy message type for protocol.