Threads can now start with arguments, which will be in ... inside of the thread

This commit is contained in:
Bart van Strien
2013-07-09 14:52:27 +02:00
parent d5ef29e015
commit 7e50691b6c
3 changed files with 51 additions and 3 deletions
+11 -1
View File
@@ -33,7 +33,17 @@ LuaThread *luax_checkthread(lua_State *L, int idx)
int w_Thread_start(lua_State *L)
{
LuaThread *t = luax_checkthread(L, 1);
luax_pushboolean(L, t->start());
int nargs = lua_gettop(L) - 1;
Variant **args = 0;
if (nargs > 0)
{
args = new Variant*[nargs];
for (int i = 0; i < nargs; ++i)
args[i] = Variant::fromLua(L, i+2);
}
luax_pushboolean(L, t->start(args, nargs));
return 1;
}