From 8d4e45c9a85175d0fc37d7d5c49ff90abb01fe4f Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 23 Nov 2018 12:24:22 +0800 Subject: =?UTF-8?q?*=E4=BF=AE=E6=94=B9lua=20bind?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/jin/main.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'src/jin/main.cpp') diff --git a/src/jin/main.cpp b/src/jin/main.cpp index fb3876b..31e837f 100644 --- a/src/jin/main.cpp +++ b/src/jin/main.cpp @@ -13,32 +13,24 @@ using namespace std; using namespace JinEngine::Filesystem; -using namespace JinEngine::Lua; // Load game under cwd. static void load(const char* cwd) { - // Global lua runtime. lua_State* L = luax_newstate(); // Open lua standard module. luax_openlibs(L); + // Open jin module. - luaopen_jin(L); - // Set current working directory. - luax_newtable(L); - luax_setfieldstring(L, "cwd", cwd); - luax_setfield(L, -2, "args"); - // Clear lua stack. - luax_clearstack(L); + JinEngine::Lua::open(L); // Boot jin and run it. - boot(L); + JinEngine::Lua::boot(L, cwd); // Close lua lib. luax_close(L); - } #ifdef _WIN32 -- cgit v1.1-26-g67d0