From 836c31dbf18e96083aee798b39e3a0621c815358 Mon Sep 17 00:00:00 2001 From: Jaroslaw Konik Date: Mon, 26 May 2025 17:20:53 +0200 Subject: [PATCH] docs --- README.md | 33 +++------------------------------ book/src/introduction.md | 6 +++--- src/lib.rs | 36 +++--------------------------------- 3 files changed, 9 insertions(+), 66 deletions(-) diff --git a/README.md b/README.md index f095853..bb057b3 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@ bevy_scriptum is a a plugin for [Bevy](https://bevyengine.org/) that allows you | 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) | +| 🌙 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) | Documentation book is available at [documentation book](https://jarkonik.github.io/bevy_scriptum/) 📖 Full API docs are available at [docs.rs](https://docs.rs/bevy_scriptum/latest/bevy_scriptum/) 🧑‍💻 @@ -90,33 +90,6 @@ which you can then call in your script like this: ```lua fun_with_string_param("Hello world!") ``` -It is also possible to split the definition of your callback functions up over multiple plugins. This enables you to split up your code by subject and keep the main initialization light and clean. -This can be accomplished by using `add_scripting_api`. Be careful though, `add_scripting` has to be called before adding plugins. -```rust -use bevy::prelude::*; -use bevy_scriptum::prelude::*; -use bevy_scriptum::runtimes::lua::prelude::*; - -struct MyPlugin; -impl Plugin for MyPlugin { - fn build(&self, app: &mut App) { - app.add_scripting_api::(|runtime| { - runtime.add_function(String::from("hello_from_my_plugin"), || { - info!("Hello from MyPlugin"); - }); - }); - } -} - -App::new() - .add_plugins(DefaultPlugins) - .add_scripting::(|_| { - // nice and clean - }) - .add_plugins(MyPlugin) - .run(); -``` - ### Usage diff --git a/book/src/introduction.md b/book/src/introduction.md index 080e247..59dd69d 100644 --- a/book/src/introduction.md +++ b/book/src/introduction.md @@ -6,9 +6,9 @@ bevy_scriptum is a a plugin for [Bevy](https://bevyengine.org/) that allows you | 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) | + | 🌙 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) | Documentation book is available at [documentation book](https://jarkonik.github.io/bevy_scriptum/) 📖 Full API docs are available at [docs.rs](https://docs.rs/bevy_scriptum/latest/bevy_scriptum/) 🧑‍💻 diff --git a/src/lib.rs b/src/lib.rs index f46f8aa..4f6eee7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,9 +6,9 @@ //! //! | 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) | +//! | 🌙 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) | //! //! Documentation book is available at [documentation book](https://jarkonik.github.io/bevy_scriptum/) 📖 //! Full API docs are available at [docs.rs](https://docs.rs/bevy_scriptum/latest/bevy_scriptum/) 🧑‍💻 @@ -95,36 +95,6 @@ //! ```lua //! fun_with_string_param("Hello world!") //! ``` -//! It is also possible to split the definition of your callback functions up over multiple plugins. This enables you to split up your code by subject and keep the main initialization light and clean. -//! This can be accomplished by using `add_scripting_api`. Be careful though, `add_scripting` has to be called before adding plugins. -//! ```no_run -//! use bevy::prelude::*; -//! use bevy_scriptum::prelude::*; -//! # #[cfg(feature = "lua")] -//! use bevy_scriptum::runtimes::lua::prelude::*; -//! -//! struct MyPlugin; -//! # #[cfg(feature = "lua")] -//! impl Plugin for MyPlugin { -//! fn build(&self, app: &mut App) { -//! app.add_scripting_api::(|runtime| { -//! runtime.add_function(String::from("hello_from_my_plugin"), || { -//! info!("Hello from MyPlugin"); -//! }); -//! }); -//! } -//! } -//! -//! # #[cfg(feature = "lua")] -//! App::new() -//! .add_plugins(DefaultPlugins) -//! .add_scripting::(|_| { -//! // nice and clean -//! }) -//! .add_plugins(MyPlugin) -//! .run(); -//! ``` -//! //! //! ## Usage //!