diff options
author | chai <chaifix@163.com> | 2018-12-20 18:34:50 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-12-20 18:34:50 +0800 |
commit | ee8ef0433e36bf354a717bd4af679a0a5af2e6be (patch) | |
tree | 2fc748510200f8bc24928d1938300eecc0604deb /src/lua/je_lua_jin.cpp | |
parent | 7ae40127f15f8f2cb963a7efeb018f7887ebc1ea (diff) |
*修改文件结构
Diffstat (limited to 'src/lua/je_lua_jin.cpp')
-rw-r--r-- | src/lua/je_lua_jin.cpp | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/src/lua/je_lua_jin.cpp b/src/lua/je_lua_jin.cpp deleted file mode 100644 index 8d79415..0000000 --- a/src/lua/je_lua_jin.cpp +++ /dev/null @@ -1,101 +0,0 @@ -#include "common/je_lua.h" -#include "common/je_lua_common.h" -#include "modules/je_lua_modules.h" -#include "embed/embed.h" -#include "je_lua_jin.h" - -namespace JinEngine -{ - namespace Lua - { - - LUA_IMPLEMENT int l_getversion(lua_State* L) - { - luax_pushstring(L, VERSION); - return 1; - } - - LUA_IMPLEMENT int l_getAuthor(lua_State* L) - { - luax_pushstring(L, AUTHOR); - return 1; - } - - LUA_IMPLEMENT 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; - } - - LUA_IMPLEMENT int l_revision(lua_State* L) - { - luax_pushnumber(L, REVISION); - return 1; - } - - // Register jin module, keep it on the top of stack. - LUA_EXPORT void open(lua_State* L) - { - luax_globaltable(L, MODULE_NAME); - - const luax_Str s[] = { - { "version", VERSION }, - { "author", AUTHOR }, - { "codename", CODE_NAME }, - { 0, 0 } - }; - const luax_Num n[] = { - { "revision", REVISION }, - { 0, 0 } - }; - // Register values. - luax_setfieldstrings(L, s); - luax_setfieldnumbers(L, n); - - luax_Reg modules[] = { - { "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 }, - //{"ai", luaopen_ai }, - { 0, 0 } - }; - - // Register sub modules. - for (int i = 0; modules[i].name; ++i) - { - modules[i].func(L); - luax_setfield(L, -2, modules[i].name); - } - - // Pop jin table. - luax_pop(L, 1); - } - - LUA_EXPORT void boot(lua_State* L, const char* cwd) - { - luax_getglobal(L, MODULE_NAME); - luax_newtable(L); - luax_setfieldstring(L, "cwd", cwd); - luax_setfield(L, -2, "args"); - luax_clearstack(L); - Embed::run(L); - } - - } // namespace Lua -} // namespace JinEngine
\ No newline at end of file |