luao3 0.1.1

Lua bindings for Rust, oriented around macros. Lossly inspired by pyo3, but based on mlua.
docs.rs failed to build luao3-0.1.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: luao3-0.1.2

luao3 Crates.io docs.rs

Lua bindings for Rust, oriented around macros.

Modeled loosely after PyO3. Based on mlua.

WARNING: This software is ALPHA quality. Expect breaking changes and API removals/additions.

Examples

use luao3::prelude::*;
use mlua::prelude::*;

#[derive(Debug, FromLua, ToLua)]
struct Foo {
    foo: String,
    #[lua(default)]
    bar: Vec<String>
}

#[lua_function]
pub fn bar(a: Foo) -> LuaResult<Foo> {
    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<i32> {
    txt.parse::<i32>().map_err(mlua::Error::external)
}

luao3::declare_simple_module! {
    name => foobar,
    members => {
        fn bar,
        fn baz as baz2
    }
}