diff options
Diffstat (limited to 'src/lua/modules/time')
-rw-r--r-- | src/lua/modules/time/je_lua_time.cpp | 7 | ||||
-rw-r--r-- | src/lua/modules/time/je_lua_timer.cpp | 13 |
2 files changed, 8 insertions, 12 deletions
diff --git a/src/lua/modules/time/je_lua_time.cpp b/src/lua/modules/time/je_lua_time.cpp index 626d843..6ad4935 100644 --- a/src/lua/modules/time/je_lua_time.cpp +++ b/src/lua/modules/time/je_lua_time.cpp @@ -34,8 +34,7 @@ namespace JinEngine LUA_IMPLEMENT int l_newTimer(lua_State* L) { - Proxy* proxy = luax_newinstance(L, Jin_Lua_Timer); - proxy->bind(new Shared<Timer>(new Timer(), Jin_Lua_Timer)); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Timer, new Shared<Timer>(new Timer(), Jin_Lua_Timer)); return 1; } @@ -55,7 +54,7 @@ namespace JinEngine LUA_EXPORT int luaopen_time(lua_State* L) { luaopen_Timer(L); - luaL_Reg f[] = { + luaL_Reg methods[] = { { "second", l_sec }, { "sleep", l_sleep }, { "newTimer", l_newTimer }, @@ -63,7 +62,7 @@ namespace JinEngine { "getDelta", l_getDelta }, { 0, 0 }, }; - luax_newlib(L, f); + luax_newlib(L, methods); return 1; } diff --git a/src/lua/modules/time/je_lua_timer.cpp b/src/lua/modules/time/je_lua_timer.cpp index 281f3c2..6dc6798 100644 --- a/src/lua/modules/time/je_lua_timer.cpp +++ b/src/lua/modules/time/je_lua_timer.cpp @@ -46,10 +46,9 @@ namespace JinEngine for(int i = 4; i <= n; ++i) func->pushParam(i); Timer::Handler* handler = timer->every(s, timerCallback, func, finishCallback); - Proxy* proxy = luax_newinstance(L, Jin_Lua_Handler); Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(handler, Jin_Lua_Handler); shrHandler->retain(); - proxy->bind(shrHandler); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Handler, shrHandler); return 1; } @@ -65,10 +64,9 @@ namespace JinEngine for (int i = 4; i <= n; ++i) func->pushParam(i); Timer::Handler* handler = timer->after(s, timerCallback, func, finishCallback); - Proxy* proxy = luax_newinstance(L, Jin_Lua_Handler); Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(handler, Jin_Lua_Handler); shrHandler->retain(); - proxy->bind(shrHandler); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Handler, shrHandler); return 1; } @@ -85,10 +83,9 @@ namespace JinEngine for (int i = 5; i <= n; ++i) func->pushParam(i); Timer::Handler* handler = timer->repeat(s, count, timerCallback, func, finishCallback); - Proxy* proxy = luax_newinstance(L, Jin_Lua_Handler); Shared<Timer::Handler>* shrHandler = new Shared<Timer::Handler>(handler, Jin_Lua_Handler); shrHandler->retain(); - proxy->bind(shrHandler); + Proxy* proxy = luax_newinstance(L, Jin_Lua_Handler, shrHandler); return 1; } @@ -128,7 +125,7 @@ namespace JinEngine LUA_EXPORT void luaopen_Timer(lua_State* L) { - luaL_Reg f[] = { + luaL_Reg methods[] = { { "__gc", l_gc }, { "every", l_every }, { "after", l_after }, @@ -139,7 +136,7 @@ namespace JinEngine { 0, 0 } }; - luax_newtype(L, Jin_Lua_Timer, f); + luax_newtype(L, Jin_Lua_Timer, methods); } } |