rlua 0.19.8

High level bindings to Lua 5.x
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
extern crate rlua;

use rlua::{Lua, UserData};

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

    let mut i = 1;

    Lua::new().context(|lua| {
        lua.scope(|scope| {
            let a = scope.create_nonstatic_userdata(MyUserData(&mut i)).unwrap();
            let b = scope.create_nonstatic_userdata(MyUserData(&mut i)).unwrap();
            //~^ error: cannot borrow `i` as mutable more than once at a time
        });
    });
}