mlua 0.2.0

High level bindings to Lua 5.1/5.2/5.3 (including LuaJIT) with support of writing native lua modules in Rust.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use mlua::{Lua, UserData, Result};

struct MyUserData<'a>(&'a mut i32);
impl<'a> UserData for MyUserData<'a> {}

fn main() {
    let mut i = 1;

    let lua = Lua::new();
    lua.scope(|scope| -> Result<()> {
        let _a = scope.create_nonstatic_userdata(MyUserData(&mut i))?;
        let _b = scope.create_nonstatic_userdata(MyUserData(&mut i))?;
        Ok(())
    });
}