Skip to content

feat: Use the Handles, Luke! #427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ name = "game_of_life"
path = "examples/game_of_life.rs"
required-features = [
"lua54",
"rhai",
# "rhai",
"bevy/file_watcher",
"bevy/multi_threaded",
]
Expand Down
22 changes: 22 additions & 0 deletions assets/reload.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- reload.lua
--
-- An example of the script reload feature. Exercise with this command:
-- ```sh
-- cargo run --features lua54,bevy/file_watcher,bevy/multi_threaded --example run-script -- reload.lua
-- ```
function on_script_loaded()
world.info("Hello world")
end

function on_script_unloaded()
world.info("Goodbye world")
return "house"
end

function on_script_reloaded(value)
if value then
world.info("I'm back. Thanks for the "..value.." keys!")
else
world.info('I have not saved any state before unloading')
end
end
2 changes: 0 additions & 2 deletions benches/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,6 @@ fn script_load_benchmarks(criterion: &mut Criterion) {
"empty Lua",
content,
&mut group,
|rand| format!("{rand}.lua"),
reload_probability,
);

Expand All @@ -265,7 +264,6 @@ fn script_load_benchmarks(criterion: &mut Criterion) {
"empty Rhai",
content,
&mut group,
|rand| format!("{rand}.rhai"),
reload_probability,
);
}
Expand Down
2 changes: 2 additions & 0 deletions crates/bevy_mod_scripting_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ fixedbitset = "0.5"
petgraph = "0.6"
bevy_mod_debugdump = "0.12"
bevy_system_reflection = { path = "../bevy_system_reflection", version = "0.1.2" }
serde = { version = "1.0", features = ["derive"] }
uuid = "1.11"

[dev-dependencies]
test_utils = { workspace = true }
Expand Down
Loading