axo-bridge 0.1.4

Lua↔Rust bridge for Axo Framework: serializes Lua UI trees to Rust nodes, registers device APIs and event callbacks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use mlua::prelude::*;

pub fn register_functions(lua: &Lua) -> LuaResult<()> {
    let globals = lua.globals();

    globals.set("log", lua.create_function(|_, msg: String| {
        println!("[Lua] {}", msg);
        Ok(())
    })?)?;

    globals.set("print", lua.create_function(|_, msg: String| {
        println!("[Lua] {}", msg);
        Ok(())
    })?)?;

    Ok(())
}