Compare commits

..

7 commits
ruby ... main

Author SHA1 Message Date
Jarosław Konik
fa70abac23
Add annotations about Ruby only being supported on Linux (#64)
Some checks failed
Book / test (push) Has been cancelled
Deploy book / deploy (push) Has been cancelled
Rust / build (push) Has been cancelled
2025-06-01 18:28:22 +02:00
41d0fd57f3 Bump version
Some checks failed
Book / test (push) Has been cancelled
Deploy book / deploy (push) Has been cancelled
Rust / build (push) Has been cancelled
2025-06-01 14:21:40 +02:00
Curt Reyes
e430795dce
Compile on windows (#62)
* Don't check for rdynamic linking on Windows for now, fixes Windows builds

---------

Co-authored-by: Jaroslaw Konik <konikjar@gmail.com>
2025-06-01 14:19:43 +02:00
Jarosław Konik
c6bdfb1400
Fix rb-sys version (#60) 2025-05-27 19:55:13 +02:00
Jarosław Konik
450962b1d0
Bump version to 0.9.0 (#59)
Some checks failed
Book / test (push) Has been cancelled
Deploy book / deploy (push) Has been cancelled
Rust / build (push) Has been cancelled
2025-05-27 19:35:32 +02:00
Jarosław Konik
53479f94b5
Ruby support (#19)
Some checks are pending
Book / test (push) Waiting to run
Deploy book / deploy (push) Waiting to run
Rust / build (push) Waiting to run
Add support for Ruby language
2025-05-27 19:19:52 +02:00
Jarosław Konik
f2bb079c60
Update README.md (#58) 2025-05-23 08:53:07 +02:00
10 changed files with 52 additions and 33 deletions

View file

@ -1,7 +1,7 @@
[package]
name = "bevy_scriptum"
authors = ["Jaroslaw Konik <konikjar@gmail.com>"]
version = "0.8.1"
version = "0.9.1"
edition = "2024"
license = "MIT OR Apache-2.0"
readme = "README.md"
@ -32,7 +32,7 @@ mlua = { version = "0.9.8", features = [
"send",
], optional = true }
magnus = { version = "0.7.1", optional = true }
rb-sys = { version = "*", default-features = false, features = ["link-ruby", "ruby-static"], optional = true }
rb-sys = { version = "0.9", default-features = false, features = ["link-ruby", "ruby-static"], optional = true }
crossbeam-channel = "0.5.15"
libc = "0.2.172"

View file

@ -6,10 +6,10 @@ bevy_scriptum is a a plugin for [Bevy](https://bevyengine.org/) that allows you
### Supported scripting languages/runtimes
| language/runtime | cargo feature | documentation chapter |
| ----------------- | ------------- | --------------------------------------------------------------- |
| ------------------------------------------ | ------------- | --------------------------------------------------------------- |
| 🌙 LuaJIT | `lua` | [link](https://jarkonik.github.io/bevy_scriptum/lua/lua.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(currently only supported on Linux) | `ruby` | [link](https://jarkonik.github.io/bevy_scriptum/ruby/ruby.html) |
Documentation book is available [here](https://jarkonik.github.io/bevy_scriptum/) 📖
@ -98,7 +98,7 @@ Add the following to your `Cargo.toml`:
```toml
[dependencies]
bevy_scriptum = { version = "0.8", features = ["lua"] }
bevy_scriptum = { version = "0.9", features = ["lua"] }
```
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 |
|--------------|-----------------------|
| 0.16 | 0.8 |
| 0.16 | 0.8-0.9 |
| 0.15 | 0.7 |
| 0.14 | 0.6 |
| 0.13 | 0.4-0.5 |

View file

@ -7,7 +7,7 @@ currently being supported with security updates.
| Version | Supported |
| ------- | ------------------ |
| 0.8 | :white_check_mark: |
| 0.9 | :white_check_mark: |
## Reporting a Vulnerability

View file

@ -2,7 +2,7 @@
| bevy version | bevy_scriptum version |
| ------------ | --------------------- |
| 0.16 | 0.8 |
| 0.16 | 0.8-0.9 |
| 0.15 | 0.7 |
| 0.14 | 0.6 |
| 0.13 | 0.4-0.5 |

View file

@ -5,7 +5,7 @@ bevy_scriptum is a a plugin for [Bevy](https://bevyengine.org/) that allows you
## Supported scripting languages/runtimes
| language/runtime | cargo feature | documentation chapter |
| ----------------- | ------------- | --------------------------------------------------------------- |
| ---------------- | ------------- | --------------------------------------------------------------- |
| 🌙 LuaJIT | `lua` | [link](https://jarkonik.github.io/bevy_scriptum/lua/lua.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) |
@ -15,6 +15,7 @@ bevy_scriptum is a a plugin for [Bevy](https://bevyengine.org/) that allows you
Full API docs are available at [docs.rs](https://docs.rs/bevy_scriptum/latest/bevy_scriptum/) 🧑‍💻
bevy_scriptum's main advantages include:
- low-boilerplate
- easy to use
- asynchronicity with a promise-based API
@ -24,6 +25,7 @@ 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.
All you need to do is register callbacks on your Bevy app like this:
```rust,no_run
# extern crate bevy;
# extern crate bevy_scriptum;
@ -43,7 +45,9 @@ fn main() {
.run();
}
```
And you can call them in your scripts like this:
```lua
hello_bevy()
```
@ -80,6 +84,7 @@ 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:
```rust,no_run
# extern crate bevy;
# extern crate bevy_scriptum;
@ -102,7 +107,9 @@ fn main() {
.run();
}
```
which you can then call in your script like this:
```lua
fun_with_string_param("Hello world!")
```
@ -113,7 +120,7 @@ Add the following to your `Cargo.toml`:
```toml
[dependencies]
bevy_scriptum = { version = "0.8", features = ["lua"] }
bevy_scriptum = { version = "0.9", features = ["lua"] }
```
or execute `cargo add bevy_scriptum --features lua` from your project directory.
@ -186,6 +193,7 @@ You can also try running provided examples by cloning this repository and runnin
```bash
cargo run --example hello_world_lua
```
The examples live in `examples` directory and their corresponding scripts live in `assets/examples` directory within the repository.
### Promises - getting return values from scripts
@ -197,6 +205,7 @@ get_player_name():and_then(function(name)
print(name)
end)
```
which will print out `John` when used with following exposed function:
```rust,no_run
@ -214,7 +223,7 @@ fn main() {
runtime.add_function(String::from("get_player_name"), || String::from("John"));
});
}
````
```
## Access entity from script
@ -222,6 +231,7 @@ A variable called `entity` is automatically available to all scripts - it repres
It exposes `index` property that returns bevy entity index.
It is useful for accessing entity's components from scripts.
It can be used in the following way:
```lua
print("Current entity index: " .. entity.index)
```

View file

@ -5,7 +5,7 @@ Add the following to your `Cargo.toml`:
```toml
[dependencies]
bevy = "0.16"
bevy_scriptum = { version = "0.8", features = ["lua"] }
bevy_scriptum = { version = "0.9", features = ["lua"] }
```
If you need a different version of bevy you need to use a matching bevy_scriptum

View file

@ -5,7 +5,7 @@ Add the following to your `Cargo.toml`:
```toml
[dependencies]
bevy = "0.16"
bevy_scriptum = { version = "0.8", features = ["rhai"] }
bevy_scriptum = { version = "0.9", features = ["rhai"] }
```
If you need a different version of bevy you need to use a matching bevy_scriptum

View file

@ -1,5 +1,7 @@
# Installation
Ruby is currently only supported on Linux.
## Ruby
To build `bevy_scriptum` with Ruby support a Ruby installation is needed to be
@ -33,7 +35,7 @@ Add the following to your `Cargo.toml`:
```toml
[dependencies]
bevy = "0.16"
bevy_scriptum = { version = "0.8", features = ["ruby"] }
bevy_scriptum = { version = "0.9", features = ["ruby"] }
```
If you need a different version of bevy you need to use a matching bevy_scriptum

View file

@ -1,3 +1,4 @@
# Ruby
This chapter demonstrates how to work with bevy_scriptum when using Ruby language runtime.
Ruby is currently only supported on Linux.

View file

@ -5,10 +5,10 @@
//! ## Supported scripting languages/runtimes
//!
//! | language/runtime | cargo feature | documentation chapter |
//! | ----------------- | ------------- | --------------------------------------------------------------- |
//! | ------------------------------------------ | ------------- | --------------------------------------------------------------- |
//! | 🌙 LuaJIT | `lua` | [link](https://jarkonik.github.io/bevy_scriptum/lua/lua.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(currently only supported on Linux) | `ruby` | [link](https://jarkonik.github.io/bevy_scriptum/ruby/ruby.html) |
//!
//! Documentation book is available [here](https://jarkonik.github.io/bevy_scriptum/) 📖
//!
@ -103,7 +103,7 @@
//!
//! ```toml
//! [dependencies]
//! bevy_scriptum = { version = "0.8", features = ["lua"] }
//! bevy_scriptum = { version = "0.9", features = ["lua"] }
//! ```
//!
//! or execute `cargo add bevy_scriptum --features lua` from your project directory.
@ -176,7 +176,7 @@
//!
//! | bevy version | bevy_scriptum version |
//! |--------------|-----------------------|
//! | 0.16 | 0.8 |
//! | 0.16 | 0.8-0.9 |
//! | 0.15 | 0.7 |
//! | 0.14 | 0.6 |
//! | 0.13 | 0.4-0.5 |
@ -510,7 +510,7 @@ impl<R: Runtime> Default for Callbacks<R> {
}
}
#[cfg(debug_assertions)]
#[cfg(all(debug_assertions, unix))]
pub extern "C" fn is_rdynamic_linking() -> bool {
unsafe {
// Get a function pointer to itself
@ -524,6 +524,12 @@ 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 use crate::{BuildScriptingRuntime as _, Runtime as _, Script};
}