aboutsummaryrefslogtreecommitdiff
path: root/src/lua/luaopen_jin.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-08-20 11:51:32 +0800
committerchai <chaifix@163.com>2018-08-20 11:51:32 +0800
commit65bafdc682db46f0f115374ad39f1fbc348832ac (patch)
tree7862548cdf01060e89a45c9817afc6e5d263acd7 /src/lua/luaopen_jin.cpp
parent9593ae6ecdfcfb876fa7953f25e19f0a97e1453a (diff)
*update
Diffstat (limited to 'src/lua/luaopen_jin.cpp')
-rw-r--r--src/lua/luaopen_jin.cpp104
1 files changed, 0 insertions, 104 deletions
diff --git a/src/lua/luaopen_jin.cpp b/src/lua/luaopen_jin.cpp
deleted file mode 100644
index ffb0f45..0000000
--- a/src/lua/luaopen_jin.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-#include "luaopen_jin.h"
-#include "lua/luax.h"
-#include "embed/embed.h"
-
-namespace jin
-{
-namespace lua
-{
-
- extern int luaopen_core(lua_State* L);
- extern int luaopen_graphics(lua_State* L);
- extern int luaopen_audio(lua_State* L);
- extern int luaopen_net(lua_State* L);
- extern int luaopen_event(lua_State* L);
- extern int luaopen_time(lua_State* L);
- extern int luaopen_mouse(lua_State* L);
- extern int luaopen_keyboard(lua_State* L);
- extern int luaopen_filesystem(lua_State* L);
- extern int luaopen_joypad(lua_State* L);
- extern int luaopen_math(lua_State* L);
- extern int luaopen_thread(lua_State* L);
- extern int luaopen_bit(lua_State* L);
-
- static int l_getversion(lua_State* L)
- {
- luax_pushstring(L, VERSION);
- return 1;
- }
-
- static int l_getAuthor(lua_State* L)
- {
- luax_pushstring(L, AUTHOR);
- return 1;
- }
-
- static int l_getOS(lua_State* L)
- {
- #ifdef _WIN32
- luax_pushstring(L, "windows");
- #elif defined __unix__
- luax_pushstring(L, "unix");
- #elif defined __APPLE__
- luax_pushstring(L, "macos");
- #endif
- return 1;
- }
-
- static int l_revision(lua_State* L)
- {
- luax_pushnumber(L, REVISION);
- return 1;
- }
-
- static const luaL_Reg f[] = {
- { "version", l_getversion },
- { "revision", l_revision },
- { "author", l_getAuthor },
- { "os", l_getOS },
- { 0, 0 }
- };
-
- // submodules
- static const luaL_Reg mods[] = {
- { "core", luaopen_core },
- { "event", luaopen_event },
- { "graphics", luaopen_graphics },
- { "time", luaopen_time },
- { "mouse", luaopen_mouse },
- { "keyboard", luaopen_keyboard },
- { "filesystem", luaopen_filesystem },
- { "net", luaopen_net },
- { "audio", luaopen_audio },
- { "joypad", luaopen_joypad },
- { "math", luaopen_math },
- { "thread", luaopen_thread },
- { "bit", luaopen_bit },
- { 0, 0 }
- };
-
- int luaopen_jin(lua_State* L)
- {
- // jin module is on top of the stack
- luax_newlib(L, f);
-
- // set to global field
- luax_justglobal(L, -1, MODULE_NAME);
-
- // register submodules
- for (int i = 0; mods[i].name; ++i)
- {
- mods[i].func(L);
- luax_setfield(L, -2, mods[i].name);
- }
-
- return 1;
- }
-
- void boot(lua_State* L)
- {
- jin::embed::boot(L);
- }
-
-} // lua
-} // jin \ No newline at end of file