use mirror_core::Result; use mlua::{Lua, Table, Value}; /// 仅存在于 CLI 侧的 DSL 扩展函数 pub fn register_mr_command(lua: &Lua) -> Result<()> { let globals = lua.globals(); let mr_table: Table = match globals.get("mr")? { Value::Table(tbl) => tbl, _ => { let tbl = lua.create_table()?; globals.set("mr", &tbl)?; tbl } }; let command_fn = lua.create_function(|_lua, mod_path: String| { let normalized = mod_path.replace(['/', '\\'], "."); Ok(normalized) })?; mr_table.set("command", command_fn)?; Ok(()) }