Skip to content

Commit 20324c7

Browse files
committed
pr feedback
1 parent fb80b18 commit 20324c7

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lute/task/src/task.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ struct LuaThread
108108
int toPush = lua_gettop(parent);
109109
// We only want to resume with the actual number of arguments here, regardless of if the first argument is a thread or a function
110110
int numResumeArgs = toPush > 1 ? toPush - 1 : 0;
111-
if (!lua_checkstack(L, 1))
111+
if (!lua_checkstack(parent, 1))
112112
luaL_error(L, "Not enough stack space to create a new thread");
113113
if (lua_isfunction(parent, 1))
114114
{
@@ -163,7 +163,7 @@ struct LuaThread
163163
if (!ok)
164164
{
165165
runtime->reportError(child);
166-
return 1;
166+
return 1;
167167
}
168168

169169
return 1;

tests/lute/task.test.luau

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ test.suite("LuteTaskSuite", function(suite)
2323
assert.eq(endTime - startTime >= 0.5, true)
2424
end)
2525

26+
suite:case("taskSpawn0ArgsErrors", function(assert)
27+
assert.errors(function()
28+
(task.spawn :: any)()
29+
end)
30+
end)
31+
32+
suite:case("taskDefer0ArgsErrors", function(assert)
33+
assert.errors(function()
34+
(task.defer :: any)()
35+
end)
36+
end)
37+
2638
suite:case("taskSpawnFunctionNoArgsCoroutineStatus", function(assert)
2739
local thread = task.spawn(function()
2840
task.wait(2)

0 commit comments

Comments
 (0)