threaded Lua VM

This commit is contained in:
Face
2025-08-08 16:51:21 +03:00
parent d4aa741452
commit 5759ee6221
13 changed files with 1552 additions and 730 deletions

View File

@@ -64,12 +64,13 @@ static func time_date_handler(vm: LuauVM) -> int:
static func time_sleep_handler(vm: LuauVM) -> int:
vm.luaL_checknumber(1)
var seconds = vm.lua_tonumber(1)
var _milliseconds = int(seconds * 1000)
# TODO: implement a proper sleep function
vm.lua_pushnumber(seconds)
return 1
if seconds > 0:
var target_time = Time.get_ticks_msec() + (seconds * 1000.0)
while Time.get_ticks_msec() < target_time:
OS.delay_msec(1)
return 0
static func time_benchmark_handler(vm: LuauVM) -> int:
vm.luaL_checktype(1, vm.LUA_TFUNCTION)