Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use mlua::{Lua, Result, Table};

#[mlua::lua_module]
fn rume(lua: &Lua) -> Result<Table> {
    let exports = lua.create_table()?;

    // Define the 'greet' function
    let greet_fn = lua.create_function(|_, name: String| {
        println!("Hello, {}!", name);
        Ok(())
    })?;

    // Set the 'greet' function in the exports table
    exports.set("greet", greet_fn)?;

    Ok(exports)
}