From 2fb51a71e53b4fc7bd4058d3a5a6f39fa81c345a Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 18 Aug 2018 14:29:11 +0800 Subject: *update --- src/main.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/main.cpp') 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 -// directory #include #endif @@ -12,27 +10,21 @@ #include +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; -- cgit v1.1-26-g67d0