Compare commits
165 commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5269c57e7b | |||
| 61a8d99140 | |||
| fd03186d73 | |||
| b93482d125 | |||
| 5a4a214f67 | |||
| e22236f201 | |||
| f404ee91f2 | |||
| 2621e1ef53 | |||
| bf9c94b7f0 | |||
| c6f52bdc8d | |||
| 3e6e14fa71 | |||
| 97b448d6f4 | |||
| ad24866ba4 | |||
| 0b68d54d53 | |||
| acebb4b8c1 | |||
| d0936c5549 | |||
| 472d03bc38 | |||
| 81fed90c5c | |||
| 1dd1e07d16 | |||
| 3a9a048e34 | |||
| 281f7851b7 | |||
| 35b4317040 | |||
| f9a7a9eb77 | |||
| 97077338f9 | |||
| 4b25bd0f18 | |||
| 0d03a47eed | |||
| ba799ee110 | |||
| d505fb33aa | |||
| 08e177dacd | |||
| 410d246cd2 | |||
| 60a22ca808 | |||
| d3ea89a417 | |||
| cdaceadd1b | |||
| 663d54e729 | |||
| 836c31dbf1 | |||
| d232ca45b1 | |||
| 2d2ba975bb | |||
| 35dc89322e | |||
| 679cfd8140 | |||
| 2bf20831be | |||
| 16ad6630dd | |||
| c49188847a | |||
| fc490f5d13 | |||
| 20f2ad8fb1 | |||
| 783183975a | |||
| 10985ca777 | |||
| da759a7e0b | |||
| 80e753812a | |||
| 9e29b803b6 | |||
| 1ea7e30c63 | |||
| f211769dc4 | |||
| c763dd06d1 | |||
| b339283901 | |||
| db573426da | |||
| 469e9aca15 | |||
| d00b98edb9 | |||
| 8bf37d0d1a | |||
| 0da69454c7 | |||
| 822cf12d59 | |||
| a888888c9d | |||
| 6f265c3ec5 | |||
| b483dcf503 | |||
| 06a7f51805 | |||
| 04d2b6b93b | |||
| 9e3dce14a2 | |||
| fc76c927ca | |||
| e5eb7cc4f5 | |||
| 20bf7121ff | |||
| 7f7943fe84 | |||
| ca82a8f3a3 | |||
| 9bec12deec | |||
| 21828eea8d | |||
| 1467fa3bba | |||
| 222aa10f2b | |||
| 8c055c5ccb | |||
| 2deec07a33 | |||
| 2a2b2343d7 | |||
| 9bcf3ee589 | |||
| e8b95f6099 | |||
| ebb6a50285 | |||
| 2835d490f6 | |||
| e06fcecec9 | |||
| 35efc45a20 | |||
| 86e7567438 | |||
| c75f158dfb | |||
| 992d19cba7 | |||
| 992eb960cb | |||
| 853879ef6d | |||
| 3028b6fe4e | |||
| 521407a6ac | |||
| 49a3ac716d | |||
| 553abeb0c3 | |||
| 07331f8d48 | |||
| 5d104a1d01 | |||
| b6e251dcca | |||
| 6bce009e04 | |||
| 4509375666 | |||
| d0746fa5db | |||
| b2ebf08805 | |||
| 9438fa62bc | |||
| 8d583642e9 | |||
| d1f8297c5f | |||
| 78eca45723 | |||
| 900d1579ee | |||
| fb627ffdda | |||
| b3cd04aad6 | |||
| 015c1827ef | |||
| 905c4c1f4b | |||
| 765c34c52e | |||
| dceb06133e | |||
| 3217b1b9fb | |||
| c5a9f54695 | |||
| fccc822f9a | |||
| 04d8845729 | |||
| 9b8b15ded7 | |||
| 3e217c1865 | |||
| 33496446c9 | |||
| 8245f14737 | |||
| e654c7fa30 | |||
| ca703cb389 | |||
| 3962fc40b1 | |||
| 62fcdab69a | |||
| bd4b377fc6 | |||
| 2a05b9a50d | |||
| 03ec5d4941 | |||
| 8e7f15ed73 | |||
| 16b322b707 | |||
| 4abd59840c | |||
| ca508bef58 | |||
| 763550b63a | |||
| 0e5257e98c | |||
| d97096bc9f | |||
| 29689a0f6b | |||
| 7eb4a346b8 | |||
| e15fb74e64 | |||
| 4b53e9d040 | |||
| 7e886a5eef | |||
| 356e552ce7 | |||
| b498da957d | |||
| 008771bb15 | |||
| e92a3afe9f | |||
| d02b6375c6 | |||
| 9db84f0360 | |||
| 4ccedf442b | |||
| 54a47572db | |||
| fcf2680824 | |||
| c46391871f | |||
| 19bb6514ed | |||
| cbde11d17b | |||
| e95f025b07 | |||
| 191cfce733 | |||
| 253761c730 | |||
| 0a9dc09b0c | |||
| f3bcacbf14 | |||
| a3a40182f5 | |||
| aee3276f2b | |||
| e82278155a | |||
| 02d0662294 | |||
| b307cf6c13 | |||
| a4c5911603 | |||
| 6be5a4dec1 | |||
| 417f4a1bfa | |||
| 5c8ec10ae9 | |||
| d8f74b0d12 | |||
| 096710d118 |
10 changed files with 33 additions and 52 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "bevy_scriptum"
|
name = "bevy_scriptum"
|
||||||
authors = ["Jaroslaw Konik <konikjar@gmail.com>"]
|
authors = ["Jaroslaw Konik <konikjar@gmail.com>"]
|
||||||
version = "0.9.1"
|
version = "0.8.1"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
@ -32,7 +32,7 @@ mlua = { version = "0.9.8", features = [
|
||||||
"send",
|
"send",
|
||||||
], optional = true }
|
], optional = true }
|
||||||
magnus = { version = "0.7.1", optional = true }
|
magnus = { version = "0.7.1", optional = true }
|
||||||
rb-sys = { version = "0.9", default-features = false, features = ["link-ruby", "ruby-static"], optional = true }
|
rb-sys = { version = "*", default-features = false, features = ["link-ruby", "ruby-static"], optional = true }
|
||||||
crossbeam-channel = "0.5.15"
|
crossbeam-channel = "0.5.15"
|
||||||
libc = "0.2.172"
|
libc = "0.2.172"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@ bevy_scriptum is a a plugin for [Bevy](https://bevyengine.org/) that allows you
|
||||||
### Supported scripting languages/runtimes
|
### Supported scripting languages/runtimes
|
||||||
|
|
||||||
| language/runtime | cargo feature | documentation chapter |
|
| language/runtime | cargo feature | documentation chapter |
|
||||||
| ------------------------------------------ | ------------- | --------------------------------------------------------------- |
|
| ----------------- | ------------- | --------------------------------------------------------------- |
|
||||||
| 🌙 LuaJIT | `lua` | [link](https://jarkonik.github.io/bevy_scriptum/lua/lua.html) |
|
| 🌙 LuaJIT | `lua` | [link](https://jarkonik.github.io/bevy_scriptum/lua/lua.html) |
|
||||||
| 🌾 Rhai | `rhai` | [link](https://jarkonik.github.io/bevy_scriptum/rhai/rhai.html) |
|
| 🌾 Rhai | `rhai` | [link](https://jarkonik.github.io/bevy_scriptum/rhai/rhai.html) |
|
||||||
| 💎 Ruby(currently only supported on Linux) | `ruby` | [link](https://jarkonik.github.io/bevy_scriptum/ruby/ruby.html) |
|
| 💎 Ruby | `ruby` | [link](https://jarkonik.github.io/bevy_scriptum/ruby/ruby.html) |
|
||||||
|
|
||||||
Documentation book is available [here](https://jarkonik.github.io/bevy_scriptum/) 📖
|
Documentation book is available [here](https://jarkonik.github.io/bevy_scriptum/) 📖
|
||||||
|
|
||||||
|
|
@ -98,7 +98,7 @@ Add the following to your `Cargo.toml`:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy_scriptum = { version = "0.9", features = ["lua"] }
|
bevy_scriptum = { version = "0.8", features = ["lua"] }
|
||||||
```
|
```
|
||||||
|
|
||||||
or execute `cargo add bevy_scriptum --features lua` from your project directory.
|
or execute `cargo add bevy_scriptum --features lua` from your project directory.
|
||||||
|
|
@ -167,7 +167,7 @@ The examples live in `examples` directory and their corresponding scripts live i
|
||||||
|
|
||||||
| bevy version | bevy_scriptum version |
|
| bevy version | bevy_scriptum version |
|
||||||
|--------------|-----------------------|
|
|--------------|-----------------------|
|
||||||
| 0.16 | 0.8-0.9 |
|
| 0.16 | 0.8 |
|
||||||
| 0.15 | 0.7 |
|
| 0.15 | 0.7 |
|
||||||
| 0.14 | 0.6 |
|
| 0.14 | 0.6 |
|
||||||
| 0.13 | 0.4-0.5 |
|
| 0.13 | 0.4-0.5 |
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ currently being supported with security updates.
|
||||||
|
|
||||||
| Version | Supported |
|
| Version | Supported |
|
||||||
| ------- | ------------------ |
|
| ------- | ------------------ |
|
||||||
| 0.9 | :white_check_mark: |
|
| 0.8 | :white_check_mark: |
|
||||||
|
|
||||||
## Reporting a Vulnerability
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
| bevy version | bevy_scriptum version |
|
| bevy version | bevy_scriptum version |
|
||||||
| ------------ | --------------------- |
|
| ------------ | --------------------- |
|
||||||
| 0.16 | 0.8-0.9 |
|
| 0.16 | 0.8 |
|
||||||
| 0.15 | 0.7 |
|
| 0.15 | 0.7 |
|
||||||
| 0.14 | 0.6 |
|
| 0.14 | 0.6 |
|
||||||
| 0.13 | 0.4-0.5 |
|
| 0.13 | 0.4-0.5 |
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ bevy_scriptum is a a plugin for [Bevy](https://bevyengine.org/) that allows you
|
||||||
## Supported scripting languages/runtimes
|
## Supported scripting languages/runtimes
|
||||||
|
|
||||||
| language/runtime | cargo feature | documentation chapter |
|
| language/runtime | cargo feature | documentation chapter |
|
||||||
| ---------------- | ------------- | --------------------------------------------------------------- |
|
| ----------------- | ------------- | --------------------------------------------------------------- |
|
||||||
| 🌙 LuaJIT | `lua` | [link](https://jarkonik.github.io/bevy_scriptum/lua/lua.html) |
|
| 🌙 LuaJIT | `lua` | [link](https://jarkonik.github.io/bevy_scriptum/lua/lua.html) |
|
||||||
| 🌾 Rhai | `rhai` | [link](https://jarkonik.github.io/bevy_scriptum/rhai/rhai.html) |
|
| 🌾 Rhai | `rhai` | [link](https://jarkonik.github.io/bevy_scriptum/rhai/rhai.html) |
|
||||||
| 💎 Ruby | `ruby` | [link](https://jarkonik.github.io/bevy_scriptum/ruby/ruby.html) |
|
| 💎 Ruby | `ruby` | [link](https://jarkonik.github.io/bevy_scriptum/ruby/ruby.html) |
|
||||||
|
|
@ -15,7 +15,6 @@ Documentation book is available [here](https://jarkonik.github.io/bevy_scriptum/
|
||||||
Full API docs are available at [docs.rs](https://docs.rs/bevy_scriptum/latest/bevy_scriptum/) 🧑💻
|
Full API docs are available at [docs.rs](https://docs.rs/bevy_scriptum/latest/bevy_scriptum/) 🧑💻
|
||||||
|
|
||||||
bevy_scriptum's main advantages include:
|
bevy_scriptum's main advantages include:
|
||||||
|
|
||||||
- low-boilerplate
|
- low-boilerplate
|
||||||
- easy to use
|
- easy to use
|
||||||
- asynchronicity with a promise-based API
|
- asynchronicity with a promise-based API
|
||||||
|
|
@ -25,7 +24,6 @@ bevy_scriptum's main advantages include:
|
||||||
Scripts are separate files that can be hot-reloaded at runtime. This allows you to quickly iterate on your game logic without having to recompile it.
|
Scripts are separate files that can be hot-reloaded at runtime. This allows you to quickly iterate on your game logic without having to recompile it.
|
||||||
|
|
||||||
All you need to do is register callbacks on your Bevy app like this:
|
All you need to do is register callbacks on your Bevy app like this:
|
||||||
|
|
||||||
```rust,no_run
|
```rust,no_run
|
||||||
# extern crate bevy;
|
# extern crate bevy;
|
||||||
# extern crate bevy_scriptum;
|
# extern crate bevy_scriptum;
|
||||||
|
|
@ -45,9 +43,7 @@ fn main() {
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
And you can call them in your scripts like this:
|
And you can call them in your scripts like this:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
hello_bevy()
|
hello_bevy()
|
||||||
```
|
```
|
||||||
|
|
@ -84,7 +80,6 @@ fn main() {
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also pass arguments to your callback functions, just like you would in a regular Bevy system - using `In` structs with tuples:
|
You can also pass arguments to your callback functions, just like you would in a regular Bevy system - using `In` structs with tuples:
|
||||||
|
|
||||||
```rust,no_run
|
```rust,no_run
|
||||||
# extern crate bevy;
|
# extern crate bevy;
|
||||||
# extern crate bevy_scriptum;
|
# extern crate bevy_scriptum;
|
||||||
|
|
@ -107,9 +102,7 @@ fn main() {
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
which you can then call in your script like this:
|
which you can then call in your script like this:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
fun_with_string_param("Hello world!")
|
fun_with_string_param("Hello world!")
|
||||||
```
|
```
|
||||||
|
|
@ -120,7 +113,7 @@ Add the following to your `Cargo.toml`:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy_scriptum = { version = "0.9", features = ["lua"] }
|
bevy_scriptum = { version = "0.8", features = ["lua"] }
|
||||||
```
|
```
|
||||||
|
|
||||||
or execute `cargo add bevy_scriptum --features lua` from your project directory.
|
or execute `cargo add bevy_scriptum --features lua` from your project directory.
|
||||||
|
|
@ -193,7 +186,6 @@ You can also try running provided examples by cloning this repository and runnin
|
||||||
```bash
|
```bash
|
||||||
cargo run --example hello_world_lua
|
cargo run --example hello_world_lua
|
||||||
```
|
```
|
||||||
|
|
||||||
The examples live in `examples` directory and their corresponding scripts live in `assets/examples` directory within the repository.
|
The examples live in `examples` directory and their corresponding scripts live in `assets/examples` directory within the repository.
|
||||||
|
|
||||||
### Promises - getting return values from scripts
|
### Promises - getting return values from scripts
|
||||||
|
|
@ -205,7 +197,6 @@ get_player_name():and_then(function(name)
|
||||||
print(name)
|
print(name)
|
||||||
end)
|
end)
|
||||||
```
|
```
|
||||||
|
|
||||||
which will print out `John` when used with following exposed function:
|
which will print out `John` when used with following exposed function:
|
||||||
|
|
||||||
```rust,no_run
|
```rust,no_run
|
||||||
|
|
@ -223,7 +214,7 @@ fn main() {
|
||||||
runtime.add_function(String::from("get_player_name"), || String::from("John"));
|
runtime.add_function(String::from("get_player_name"), || String::from("John"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
```
|
````
|
||||||
|
|
||||||
## Access entity from script
|
## Access entity from script
|
||||||
|
|
||||||
|
|
@ -231,7 +222,6 @@ A variable called `entity` is automatically available to all scripts - it repres
|
||||||
It exposes `index` property that returns bevy entity index.
|
It exposes `index` property that returns bevy entity index.
|
||||||
It is useful for accessing entity's components from scripts.
|
It is useful for accessing entity's components from scripts.
|
||||||
It can be used in the following way:
|
It can be used in the following way:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
print("Current entity index: " .. entity.index)
|
print("Current entity index: " .. entity.index)
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ Add the following to your `Cargo.toml`:
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy = "0.16"
|
bevy = "0.16"
|
||||||
bevy_scriptum = { version = "0.9", features = ["lua"] }
|
bevy_scriptum = { version = "0.8", features = ["lua"] }
|
||||||
```
|
```
|
||||||
|
|
||||||
If you need a different version of bevy you need to use a matching bevy_scriptum
|
If you need a different version of bevy you need to use a matching bevy_scriptum
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ Add the following to your `Cargo.toml`:
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy = "0.16"
|
bevy = "0.16"
|
||||||
bevy_scriptum = { version = "0.9", features = ["rhai"] }
|
bevy_scriptum = { version = "0.8", features = ["rhai"] }
|
||||||
```
|
```
|
||||||
|
|
||||||
If you need a different version of bevy you need to use a matching bevy_scriptum
|
If you need a different version of bevy you need to use a matching bevy_scriptum
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
Ruby is currently only supported on Linux.
|
|
||||||
|
|
||||||
## Ruby
|
## Ruby
|
||||||
|
|
||||||
To build `bevy_scriptum` with Ruby support a Ruby installation is needed to be
|
To build `bevy_scriptum` with Ruby support a Ruby installation is needed to be
|
||||||
|
|
@ -35,7 +33,7 @@ Add the following to your `Cargo.toml`:
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy = "0.16"
|
bevy = "0.16"
|
||||||
bevy_scriptum = { version = "0.9", features = ["ruby"] }
|
bevy_scriptum = { version = "0.8", features = ["ruby"] }
|
||||||
```
|
```
|
||||||
|
|
||||||
If you need a different version of bevy you need to use a matching bevy_scriptum
|
If you need a different version of bevy you need to use a matching bevy_scriptum
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
# Ruby
|
# Ruby
|
||||||
|
|
||||||
This chapter demonstrates how to work with bevy_scriptum when using Ruby language runtime.
|
This chapter demonstrates how to work with bevy_scriptum when using Ruby language runtime.
|
||||||
Ruby is currently only supported on Linux.
|
|
||||||
|
|
|
||||||
16
src/lib.rs
16
src/lib.rs
|
|
@ -5,10 +5,10 @@
|
||||||
//! ## Supported scripting languages/runtimes
|
//! ## Supported scripting languages/runtimes
|
||||||
//!
|
//!
|
||||||
//! | language/runtime | cargo feature | documentation chapter |
|
//! | language/runtime | cargo feature | documentation chapter |
|
||||||
//! | ------------------------------------------ | ------------- | --------------------------------------------------------------- |
|
//! | ----------------- | ------------- | --------------------------------------------------------------- |
|
||||||
//! | 🌙 LuaJIT | `lua` | [link](https://jarkonik.github.io/bevy_scriptum/lua/lua.html) |
|
//! | 🌙 LuaJIT | `lua` | [link](https://jarkonik.github.io/bevy_scriptum/lua/lua.html) |
|
||||||
//! | 🌾 Rhai | `rhai` | [link](https://jarkonik.github.io/bevy_scriptum/rhai/rhai.html) |
|
//! | 🌾 Rhai | `rhai` | [link](https://jarkonik.github.io/bevy_scriptum/rhai/rhai.html) |
|
||||||
//! | 💎 Ruby(currently only supported on Linux) | `ruby` | [link](https://jarkonik.github.io/bevy_scriptum/ruby/ruby.html) |
|
//! | 💎 Ruby | `ruby` | [link](https://jarkonik.github.io/bevy_scriptum/ruby/ruby.html) |
|
||||||
//!
|
//!
|
||||||
//! Documentation book is available [here](https://jarkonik.github.io/bevy_scriptum/) 📖
|
//! Documentation book is available [here](https://jarkonik.github.io/bevy_scriptum/) 📖
|
||||||
//!
|
//!
|
||||||
|
|
@ -103,7 +103,7 @@
|
||||||
//!
|
//!
|
||||||
//! ```toml
|
//! ```toml
|
||||||
//! [dependencies]
|
//! [dependencies]
|
||||||
//! bevy_scriptum = { version = "0.9", features = ["lua"] }
|
//! bevy_scriptum = { version = "0.8", features = ["lua"] }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! or execute `cargo add bevy_scriptum --features lua` from your project directory.
|
//! or execute `cargo add bevy_scriptum --features lua` from your project directory.
|
||||||
|
|
@ -176,7 +176,7 @@
|
||||||
//!
|
//!
|
||||||
//! | bevy version | bevy_scriptum version |
|
//! | bevy version | bevy_scriptum version |
|
||||||
//! |--------------|-----------------------|
|
//! |--------------|-----------------------|
|
||||||
//! | 0.16 | 0.8-0.9 |
|
//! | 0.16 | 0.8 |
|
||||||
//! | 0.15 | 0.7 |
|
//! | 0.15 | 0.7 |
|
||||||
//! | 0.14 | 0.6 |
|
//! | 0.14 | 0.6 |
|
||||||
//! | 0.13 | 0.4-0.5 |
|
//! | 0.13 | 0.4-0.5 |
|
||||||
|
|
@ -510,7 +510,7 @@ impl<R: Runtime> Default for Callbacks<R> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(debug_assertions, unix))]
|
#[cfg(debug_assertions)]
|
||||||
pub extern "C" fn is_rdynamic_linking() -> bool {
|
pub extern "C" fn is_rdynamic_linking() -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
// Get a function pointer to itself
|
// Get a function pointer to itself
|
||||||
|
|
@ -524,12 +524,6 @@ pub extern "C" fn is_rdynamic_linking() -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(not(debug_assertions), not(unix)))]
|
|
||||||
pub extern "C" fn is_rdynamic_linking() -> bool {
|
|
||||||
// On Windows or in release builds, return a default value
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
pub use crate::{BuildScriptingRuntime as _, Runtime as _, Script};
|
pub use crate::{BuildScriptingRuntime as _, Runtime as _, Script};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue