From 8806941a136feeb6921884cd07aba7c8a468abb0 Mon Sep 17 00:00:00 2001 From: alemi Date: Wed, 14 Aug 2024 17:16:58 +0200 Subject: [PATCH] feat(lua): expose hash fn --- src/ffi/lua.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ffi/lua.rs b/src/ffi/lua.rs index 8bd59e8..b6ac318 100644 --- a/src/ffi/lua.rs +++ b/src/ffi/lua.rs @@ -269,6 +269,10 @@ fn get_logger(_: &Lua, (): ()) -> LuaResult { Ok(LuaLogger(sub)) } +fn hash(_: &Lua, (txt,): (String,)) -> LuaResult { + Ok(crate::hash(txt)) +} + // define module and exports #[mlua::lua_module] fn codemp_lua(lua: &Lua) -> LuaResult { @@ -279,6 +283,9 @@ fn codemp_lua(lua: &Lua) -> LuaResult { exports.set("get_client", lua.create_function(get_client)?)?; exports.set("close_client", lua.create_function(close_client)?)?; + // utils + exports.set("hash", lua.create_function(hash)?)?; + // runtime exports.set("runtime_drive_forever", lua.create_function(runtime_drive_forever)?)?;