Skip to content

Commit

Permalink
Lua support (#16)
Browse files Browse the repository at this point in the history
* adds Lua language support
* makes the library generic, allowing for easy extension for more languages
* small improvements and fixes
  • Loading branch information
jarkonik authored Jun 16, 2024
1 parent 7846b55 commit 6726e40
Show file tree
Hide file tree
Showing 104 changed files with 3,425 additions and 658 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/deploy_book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy book
on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write # To push a branch
pages: write # To push to a GitHub Pages site
id-token: write # To update the deployment status
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install latest mdbook
run: |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
mkdir mdbook
curl -sSL $url | tar -xz --directory=./mdbook
echo `pwd`/mdbook >> $GITHUB_PATH
- name: Build Book
run: |
cd book
mdbook build
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: 'book'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
8 changes: 4 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Clippy
run: cargo clippy --verbose -- -D warnings
run: cargo clippy --all-features --verbose -- -D warnings
- name: Build
run: cargo build --verbose
run: cargo build --all-features --verbose
- name: Run tests
run: cargo test --verbose
run: cargo test --all-features --verbose
- name: Install cargo-examples
run: cargo install cargo-examples
- name: Run all examples
run: cargo examples
run: cargo examples --features=lua,rhai
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/target
/Cargo.lock
.vscode
rust-analyzer.json
93 changes: 91 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,102 @@ description = "Plugin for Bevy engine that allows you to write some of your game
repository = "https://github.com/jarkonik/bevy_scriptum"
keywords = ["bevy", "rhai", "scripting", "game", "gamedev"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
lua = ["mlua/luajit"]
rhai = ["dep:rhai"]

[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"] }
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 }

[[example]]
name = "call_function_from_rust_rhai"
path = "examples/rhai/call_function_from_rust.rs"

[[example]]
name = "current_entity_rhai"
path = "examples/rhai/current_entity.rs"

[[example]]
name = "custom_type_rhai"
path = "examples/rhai/custom_type.rs"

[[example]]
name = "ecs_rhai"
path = "examples/rhai/ecs.rs"

[[example]]
name = "entity_variable_rhai"
path = "examples/rhai/entity_variable.rs"

[[example]]
name = "function_params_rhai"
path = "examples/rhai/function_params.rs"

[[example]]
name = "hello_world_rhai"
path = "examples/rhai/hello_world.rs"

[[example]]
name = "non_closure_system_rhai"
path = "examples/rhai/non_closure_system.rs"

[[example]]
name = "promises_rhai"
path = "examples/rhai/promises.rs"

[[example]]
name = "side_effects_rhai"
path = "examples/rhai/side_effects.rs"

[[example]]
name = "call_function_from_rust_lua"
path = "examples/lua/call_function_from_rust.rs"

[[example]]
name = "current_entity_lua"
path = "examples/lua/current_entity.rs"

[[example]]
name = "custom_type_lua"
path = "examples/lua/custom_type.rs"

[[example]]
name = "ecs_lua"
path = "examples/lua/ecs.rs"

[[example]]
name = "entity_variable_lua"
path = "examples/lua/entity_variable.rs"

[[example]]
name = "function_params_lua"
path = "examples/lua/function_params.rs"

[[example]]
name = "hello_world_lua"
path = "examples/lua/hello_world.rs"

[[example]]
name = "non_closure_system_lua"
path = "examples/lua/non_closure_system.rs"

[[example]]
name = "promises_lua"
path = "examples/lua/promises.rs"

[[example]]
name = "side_effects_lua"
path = "examples/lua/side_effects.rs"

[dev-dependencies]
tracing-subscriber = "0.3.18"
mlua = { version = "0.9.8", features = ["luajit", "vendored", "send"] }
rhai = { version = "1.14.0", features = ["sync", "internals", "unchecked"] }
Loading

0 comments on commit 6726e40

Please sign in to comment.