cleanup docs

This commit is contained in:
Jaroslaw Konik 2025-05-27 07:00:00 +02:00
parent 97077338f9
commit f9a7a9eb77
5 changed files with 5 additions and 25 deletions

View file

@ -32,8 +32,6 @@ fn call_lua_on_update_from_rust(
.unwrap(); .unwrap();
} }
} }
fn main() {}
``` ```
We can also pass some arguments by providing a tuple or `Vec` as the last We can also pass some arguments by providing a tuple or `Vec` as the last
@ -57,8 +55,6 @@ fn call_lua_on_update_from_rust(
.unwrap(); .unwrap();
} }
} }
fn main() {}
``` ```
They will be passed to `on_update` Lua function They will be passed to `on_update` Lua function

View file

@ -16,8 +16,6 @@ fn my_spawner(mut commands: Commands, assets_server: Res<AssetServer>) {
assets_server.load("my_script.lua"), assets_server.load("my_script.lua"),
)); ));
} }
fn main() {}
``` ```
After they scripts have been evaled by bevy_scriptum, the entities that they've After they scripts have been evaled by bevy_scriptum, the entities that they've
@ -41,6 +39,4 @@ fn my_system(
// do something with scripted entities // do something with scripted entities
} }
} }
fn main() {}
``` ```

View file

@ -32,8 +32,6 @@ fn call_lua_on_update_from_rust(
.unwrap(); .unwrap();
} }
} }
fn main() {}
``` ```
We can also pass some arguments by providing a tuple or `Vec` as the last We can also pass some arguments by providing a tuple or `Vec` as the last
@ -57,8 +55,6 @@ fn call_lua_on_update_from_rust(
.unwrap(); .unwrap();
} }
} }
fn main() {}
``` ```
They will be passed to `on_update` Lua function They will be passed to `on_update` Lua function

View file

@ -16,8 +16,6 @@ fn my_spawner(mut commands: Commands, assets_server: Res<AssetServer>) {
assets_server.load("my_script.lua"), assets_server.load("my_script.lua"),
)); ));
} }
fn main() {}
``` ```
After they scripts have been evaled by bevy_scriptum, the entities that they've After they scripts have been evaled by bevy_scriptum, the entities that they've
@ -41,6 +39,4 @@ fn my_system(
// do something with scripted entities // do something with scripted entities
} }
} }
fn main() {}
``` ```

View file

@ -95,8 +95,6 @@ fn teardown(
} }
} }
} }
fn main() {}
``` ```
And to tie this all together we do the following: And to tie this all together we do the following:
@ -122,11 +120,11 @@ fn main() {
.run(); .run();
} }
fn init() {} // Implemented elsewhere # fn init() {}
fn update() {} // Implemented elsewhere # fn update() {}
fn despawn() {} // Implemented elsewhere # fn despawn() {}
fn teardown() {} // Implemented elsewhere # fn teardown() {}
fn spawn_player() {} // Implemented elsewhere # fn spawn_player() {}
``` ```
`despawn` can be implemented as: `despawn` can be implemented as:
@ -141,8 +139,6 @@ use bevy_scriptum::runtimes::lua::prelude::*;
fn despawn(In((entity,)): In<(BevyEntity,)>, mut commands: Commands) { fn despawn(In((entity,)): In<(BevyEntity,)>, mut commands: Commands) {
commands.entity(entity.0).despawn(); commands.entity(entity.0).despawn();
} }
fn main() {} // Implemented elsewhere
``` ```
Implementation of `spawn_player` has been left out as an exercise for the reader. Implementation of `spawn_player` has been left out as an exercise for the reader.