diff options
author | chai <chaifix@163.com> | 2018-08-18 14:29:11 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-08-18 14:29:11 +0800 |
commit | 2fb51a71e53b4fc7bd4058d3a5a6f39fa81c345a (patch) | |
tree | 973d9e020b5a230d2886c564ef3445e1b654ab2a /src/main.cpp | |
parent | a68d5cf198a87bb3e14d03dc7347ed52134355d4 (diff) |
*update
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/main.cpp b/src/main.cpp index bd1c1af..ce70e65 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,5 @@ #ifdef _WIN32 -// SDL main entry #include <SDL2/SDL_Main.h> -// directory #include <direct.h> #endif @@ -12,27 +10,21 @@ #include <Windows.h> +using namespace jin::lua; + int main(int argc, char* argv[]) { - // global lua state, all lua values are here lua_State* L = luax_newstate(); - luax_openlibs(L); - /** - * open jin module, jin module is on the top - * of stack - */ - jin::lua::luaopen_jin(L); + luax_openlibs(L); + luaopen_jin(L); // add args to global field luax_newtable(L); for (int i = 0; i < argc; ++i) luax_setraw_string(L, -2, i + 1, argv[i]); luax_setfield(L, -2, "_argv"); - - /** - * jin._dir is the folder of jin binary executable - */ + const int BUFFER_SIZE = 512; char buffer[BUFFER_SIZE]; #ifdef _WIN32 @@ -43,7 +35,7 @@ int main(int argc, char* argv[]) #undef BUFFER_SIZE luax_setfield_string(L, "_dir", buffer); // boot - jin::lua::boot(L); + boot(L); luax_close(L); return 0; |