aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules/thread/je_lua_thread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/modules/thread/je_lua_thread.cpp')
-rw-r--r--src/lua/modules/thread/je_lua_thread.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/lua/modules/thread/je_lua_thread.cpp b/src/lua/modules/thread/je_lua_thread.cpp
index 070e9ac..2444e7b 100644
--- a/src/lua/modules/thread/je_lua_thread.cpp
+++ b/src/lua/modules/thread/je_lua_thread.cpp
@@ -29,8 +29,7 @@ namespace JinEngine
luax_openlibs(L);
luaopen_jin(L);
luax_getglobal(L, MODULE_NAME);
- Proxy* proxy = luax_newinstance(L, Jin_Lua_Thread);
- proxy->bind(&shared);
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Thread, &shared);
luax_setfield(L, -2, "_curThread");
luax_dostring(L, shared->code.c_str());
luax_close(L);
@@ -126,8 +125,7 @@ namespace JinEngine
case Thread::Variant::POINTER:
Proxy* p = (Proxy*)v.pointer;
- Proxy* proxy = luax_newinstance(L, p->getObjectType());
- proxy->bind(p->shared);
+ Proxy* proxy = luax_newinstance(L, p->getObjectType(), p->shared);
break;
}
@@ -160,8 +158,7 @@ namespace JinEngine
case Thread::Variant::POINTER:
Proxy* p = (Proxy*)v.pointer;
const char* objType = p->getObjectType();
- Proxy* proxy = luax_newinstance(L, objType);
- proxy->bind(p->shared);
+ Proxy* proxy = luax_newinstance(L, objType, p->shared);
break;
}
@@ -217,9 +214,8 @@ namespace JinEngine
{
const char* name = luax_checkstring(L, 1);
const char* code = luax_checkstring(L, 2);
- Proxy* proxy = luax_newinstance(L, Jin_Lua_Thread);
Thread* thread = new Thread(name, code, threadRunner);
- proxy->bind(new Shared<Thread>(thread, Jin_Lua_Thread));
+ Proxy* proxy = luax_newinstance(L, Jin_Lua_Thread, new Shared<Thread>(thread, Jin_Lua_Thread));
return 1;
}
@@ -234,12 +230,12 @@ namespace JinEngine
{
luaopen_Thread(L);
- luaL_Reg f[] = {
+ luaL_Reg methods[] = {
{ "newThread", l_newThread },
{ "getThread", l_getThread },
{ 0, 0 }
};
- luax_newlib(L, f);
+ luax_newlib(L, methods);
return 1;
}