diff --git a/Cargo.lock b/Cargo.lock index 0161d6b3..091c98e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1335,7 +1335,7 @@ dependencies = [ [[package]] name = "mlua-luau-runtime" version = "0.0.0" -source = "git+https://github.com/lune-org/mlua-luau-runtime?rev=f4ecf7e01845399b21a93d809b9c98e89d5a3bf5#f4ecf7e01845399b21a93d809b9c98e89d5a3bf5" +source = "git+https://github.com/lune-org/mlua-luau-runtime?rev=a5ae251fa3d62bb023dfbfc8ef692b28ff7a9a16#a5ae251fa3d62bb023dfbfc8ef692b28ff7a9a16" dependencies = [ "async-executor", "concurrent-queue", @@ -1343,6 +1343,7 @@ dependencies = [ "event-listener", "futures-lite", "mlua", + "rustc-hash", "tracing", ] diff --git a/Cargo.toml b/Cargo.toml index 7bfb98c9..24f895fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,7 +84,7 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] } tokio = { version = "1.24", features = ["full", "tracing"] } os_str_bytes = { version = "6.4", features = ["conversions"] } -mlua-luau-runtime = { git = "https://github.com/lune-org/mlua-luau-runtime", rev = "f4ecf7e01845399b21a93d809b9c98e89d5a3bf5" } +mlua-luau-runtime = { git = "https://github.com/lune-org/mlua-luau-runtime", rev = "a5ae251fa3d62bb023dfbfc8ef692b28ff7a9a16" } mlua = { version = "0.9.5", features = [ "async", "luau", diff --git a/src/lune/globals/require/context.rs b/src/lune/globals/require/context.rs index f5272cff..71c2afd1 100644 --- a/src/lune/globals/require/context.rs +++ b/src/lune/globals/require/context.rs @@ -172,9 +172,10 @@ impl<'lua> RequireContext { .into_lua_thread(lua)?; // Schedule the thread to run, wait for it to finish running - let thread_handle = lua.push_thread_front(file_thread, ())?; - thread_handle.listen().await; - let thread_res = thread_handle.result(lua).unwrap(); + let thread_id = lua.push_thread_front(file_thread, ())?; + lua.track_thread(thread_id); + lua.wait_for_thread(thread_id).await; + let thread_res = lua.get_thread_result(thread_id).unwrap(); // Return the result of the thread, storing any lua value(s) in the registry match thread_res { diff --git a/src/lune/mod.rs b/src/lune/mod.rs index 892efb42..b9df79d0 100644 --- a/src/lune/mod.rs +++ b/src/lune/mod.rs @@ -65,12 +65,12 @@ impl Runtime { eprintln!("{}", RuntimeError::from(e)); }); - let handle = rt.push_thread_front(main, ())?; + let id = rt.push_thread_front(main, ())?; rt.run().await; // TODO: Grab exit code that user set, if available - let res = handle.result(&self.lua).unwrap(); + let res = rt.get_thread_result(id).unwrap(); Ok(match res { Ok(_) => ExitCode::SUCCESS, Err(_) => ExitCode::FAILURE,