aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules/time
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-11-12 22:23:35 +0800
committerchai <chaifix@163.com>2018-11-12 22:23:35 +0800
commitc7e59fb376453e5abad8c862b52eb0f4c7ba829b (patch)
treecaefc559396525f6521ad8ff8c4f7f3f035942c2 /src/lua/modules/time
parentaf62f267a24091a16cbafe844d59cdbd4e78f5b1 (diff)
*修改结构
Diffstat (limited to 'src/lua/modules/time')
-rw-r--r--src/lua/modules/time/je_lua_time.cpp19
-rw-r--r--src/lua/modules/time/je_lua_timer.cpp22
2 files changed, 20 insertions, 21 deletions
diff --git a/src/lua/modules/time/je_lua_time.cpp b/src/lua/modules/time/je_lua_time.cpp
index e565eab..c42fc0f 100644
--- a/src/lua/modules/time/je_lua_time.cpp
+++ b/src/lua/modules/time/je_lua_time.cpp
@@ -49,22 +49,21 @@ namespace JinEngine
context.current = getSecond();
return 0;
}
-
- LUA_IMPLEMENT const luaL_Reg f[] = {
- { "second", l_sec },
- { "sleep", l_sleep },
- { "newTimer", l_newTimer },
- { "step", l_step },
- { "getDelta", l_getDelta },
- { 0, 0 },
- };
LUA_PORT int luaopen_Timer(lua_State* L);
LUA_EXPORT int luaopen_time(lua_State* L)
{
luaopen_Timer(L);
-
+
+ luaL_Reg f[] = {
+ { "second", l_sec },
+ { "sleep", l_sleep },
+ { "newTimer", l_newTimer },
+ { "step", l_step },
+ { "getDelta", l_getDelta },
+ { 0, 0 },
+ };
luax_newlib(L, f);
return 1;
}
diff --git a/src/lua/modules/time/je_lua_timer.cpp b/src/lua/modules/time/je_lua_timer.cpp
index 239d1dd..42d4215 100644
--- a/src/lua/modules/time/je_lua_timer.cpp
+++ b/src/lua/modules/time/je_lua_timer.cpp
@@ -126,19 +126,19 @@ namespace JinEngine
return 0;
}
- LUA_IMPLEMENT const luaL_Reg f[] = {
- { "__gc", l_gc },
- { "every", l_every },
- { "after", l_after },
- { "duplicate", l_repeat },
- { "update", l_update },
- { "cancel", l_cancel },
- { "cancelAll", l_cancelAll },
- { 0, 0 }
- };
-
LUA_EXPORT int luaopen_Timer(lua_State* L)
{
+ luaL_Reg f[] = {
+ { "__gc", l_gc },
+ { "every", l_every },
+ { "after", l_after },
+ { "duplicate", l_repeat },
+ { "update", l_update },
+ { "cancel", l_cancel },
+ { "cancelAll", l_cancelAll },
+ { 0, 0 }
+ };
+
luax_newtype(L, JIN_TIME_TIMER, f);
return 0;
}