From b507624d918e47da7873ced850ded68d14884e59 Mon Sep 17 00:00:00 2001 From: Quaternions <krakow20@gmail.com> Date: Wed, 23 Apr 2025 13:53:54 -0700 Subject: [PATCH] roblox_emulator: shove tick into task module --- lib/roblox_emulator/src/runner/task.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/roblox_emulator/src/runner/task.rs b/lib/roblox_emulator/src/runner/task.rs index 8f934aa..7e367c3 100644 --- a/lib/roblox_emulator/src/runner/task.rs +++ b/lib/roblox_emulator/src/runner/task.rs @@ -2,6 +2,9 @@ fn no_op(_lua:&mlua::Lua,_time:Option<super::number::Number>)->mlua::Result<f64>{ Ok(0.0) } +fn tick(_lua:&mlua::Lua,_:())->mlua::Result<f64>{ + Ok(0.0) +} // This is used to avoid calling coroutine.yield from the rust side. const LUA_WAIT:&str= "local coroutine_yield=coroutine.yield @@ -31,5 +34,9 @@ pub fn set_globals(lua:&mlua::Lua,globals:&mlua::Table)->Result<(),mlua::Error>{ globals.raw_set("wait",wait)?; + // TODO: move this somewhere it belongs + let tick=lua.create_function(tick)?; + globals.raw_set("tick",tick)?; + Ok(()) }