Skip to content
Draft
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
14 changes: 12 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,27 @@ keywords = ["bevy", "rhai", "scripting", "game", "gamedev"]
[features]
lua = ["mlua/luajit"]
rhai = ["dep:rhai"]
rune = ["dep:rune"]

[dependencies]
bevy = { default-features = false, version = "0.13.0", features = [
"bevy_asset",
] }
serde = "1.0.162"
rhai = { version = "1.14.0", features = ["sync", "internals", "unchecked"], optional = true }
rhai = { version = "1.14.0", features = [
"sync",
"internals",
"unchecked",
], optional = true }
thiserror = "1.0.40"
anyhow = "1.0.82"
tracing = "0.1.40"
mlua = { version = "0.9.8", features = ["luajit", "vendored", "send"], optional = true }
mlua = { version = "0.9.8", features = [
"luajit",
"vendored",
"send",
], optional = true }
rune = { version = "0.13.3", optional = true, features = ["alloc"] }

[[example]]
name = "call_function_from_rust_rhai"
Expand Down
2 changes: 1 addition & 1 deletion assets/tests/lua/call_script_function_with_params.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ State = {
}

function test_func(x)
called_with = x
State.called_with = x
end
3 changes: 3 additions & 0 deletions assets/tests/rune/call_script_function_with_params.rn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn test_func(x) {
set_state_value("called_with", x);
}
3 changes: 3 additions & 0 deletions assets/tests/rune/promise_runtime_error.rn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn test_func() {
rust_func().then(|x| dbg("abc" + 5));
}
3 changes: 3 additions & 0 deletions assets/tests/rune/return_via_promise.rn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn test_func() {
rust_func().then(|x| set_state_value("x", x));
}
3 changes: 3 additions & 0 deletions assets/tests/rune/rust_function_gets_called_from_script.rn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn test_func() {
rust_func();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn test_func() {
rust_func(5, "test");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn test_func() {
rust_func(5);
}
3 changes: 3 additions & 0 deletions assets/tests/rune/script_function_gets_called_from_rust.rn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn test_func() {
increment_times_called();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pub fn test_func(a, b) {
set_state_value("a_value", a);
set_state_value("b_value", b);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn test_func(a) {
set_state_value("a_value", a);
}
3 changes: 3 additions & 0 deletions assets/tests/rune/side_effects.rn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn test_func() {
spawn_entity();
}
2 changes: 2 additions & 0 deletions src/runtimes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
pub mod lua;
#[cfg(feature = "rhai")]
pub mod rhai;
#[cfg(feature = "rune")]
pub mod rune;
Loading