aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp20
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;