Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/techcable/luao3
Lua bindings for Rust, oriented around macros. Modeled loosely after `pyo3` and based on `mlua`.
https://github.com/techcable/luao3
binding lua macros mlua rust
Last synced: 7 days ago
JSON representation
Lua bindings for Rust, oriented around macros. Modeled loosely after `pyo3` and based on `mlua`.
- Host: GitHub
- URL: https://github.com/techcable/luao3
- Owner: Techcable
- License: mit
- Created: 2022-03-10T04:53:45.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-03-13T00:29:37.000Z (over 2 years ago)
- Last Synced: 2024-09-28T15:23:02.564Z (7 days ago)
- Topics: binding, lua, macros, mlua, rust
- Language: Rust
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
luao3 [![Crates.io](https://img.shields.io/crates/v/luao3)](https://crates.io/crates/luao3) [![docs.rs](https://img.shields.io/docsrs/luao3)](https://docs.rs/luao3)
=====
Lua bindings for Rust, oriented around macros.Modeled loosely after [PyO3](https://pyo3.rs/). Based on [mlua](https://docs.rs/mlua).
**WARNING**: This software is *ALPHA* quality. Expect breaking changes and API removals/additions.
## Examples
```rust
use luao3::prelude::*;
use mlua::prelude::*;#[derive(Debug, FromLua, ToLua)]
struct Foo {
foo: String,
#[lua(default)]
bar: Vec
}#[lua_function]
pub fn bar(a: Foo) -> LuaResult {
Ok(Foo {
foo: format!("baz{}", a.foo),
bar: vec!["foo".into(), "baz".into(), a.bar.get(0).cloned()
.unwrap_or_else(|| "baz".into())]
})
}#[lua_function]
pub fn baz(txt: String) -> LuaResult {
txt.parse::().map_err(mlua::Error::external)
}luao3::declare_simple_module! {
name => foobar,
members => {
fn bar,
fn baz as baz2
}
}
```