From 7322a090355af1989d7a1de0de431b6c89844fe2 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 25 Oct 2018 08:18:13 +0800 Subject: =?UTF-8?q?*=E5=A2=9E=E5=8A=A0lua=E5=AF=BC=E5=87=BA=E5=AE=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lua/modules/filesystem/je_lua_filesystem.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/lua/modules/filesystem/je_lua_filesystem.cpp') diff --git a/src/lua/modules/filesystem/je_lua_filesystem.cpp b/src/lua/modules/filesystem/je_lua_filesystem.cpp index 7466ce8..3c3c12c 100644 --- a/src/lua/modules/filesystem/je_lua_filesystem.cpp +++ b/src/lua/modules/filesystem/je_lua_filesystem.cpp @@ -1,3 +1,4 @@ +#include "lua/common/je_lua_common.h" #include "lua/modules/luax.h" #include "libjin/jin.h" #include @@ -9,25 +10,25 @@ namespace JinEngine namespace Lua { - static struct + LUA_IMPLEMENT struct { AssetDatabase* fs; } context; - static int l_init(lua_State* L) + LUA_IMPLEMENT int l_init(lua_State* L) { context.fs = AssetDatabase::get(); return 0; } - static int l_mount(lua_State* L) + LUA_IMPLEMENT int l_mount(lua_State* L) { const char* path = luax_checkstring(L, 1); context.fs->mount(path); return 0; } - static int l_exist(lua_State * L) + LUA_IMPLEMENT int l_exist(lua_State * L) { const char* path = luax_checkstring(L, 1); int r = context.fs->exists(path); @@ -35,7 +36,7 @@ namespace JinEngine return 1; } - static int l_isDir(lua_State* L) + LUA_IMPLEMENT int l_isDir(lua_State* L) { const char* path = luax_checkstring(L, 1); int r = context.fs->isDir(path); @@ -43,7 +44,7 @@ namespace JinEngine return 1; } - static int l_isFile(lua_State* L) + LUA_IMPLEMENT int l_isFile(lua_State* L) { const char* path = luax_checkstring(L, 1); int r = context.fs->isFile(path); @@ -51,7 +52,7 @@ namespace JinEngine return 1; } - static int loadbuffer(lua_State* L) + LUA_IMPLEMENT int loadbuffer(lua_State* L) { const char* filename = lua_tostring(L, -1); Buffer bf; @@ -60,7 +61,7 @@ namespace JinEngine return 1; } - static int loader(lua_State* L) + LUA_IMPLEMENT int loader(lua_State* L) { const char * filename = lua_tostring(L, -1); @@ -107,7 +108,7 @@ namespace JinEngine return 1; } - static int l_read(lua_State* L) + LUA_IMPLEMENT int l_read(lua_State* L) { AssetDatabase* fs = context.fs; const char* file = luax_checkstring(L, 1); @@ -119,7 +120,7 @@ namespace JinEngine return 2; } - static const luaL_Reg f[] = { + LUA_IMPLEMENT const luaL_Reg f[] = { { "init", l_init }, { "mount", l_mount }, { "isDirectory", l_isDir }, @@ -129,7 +130,7 @@ namespace JinEngine { 0, 0 } }; - int luaopen_filesystem(lua_State* L) + LUA_EXPORT int luaopen_filesystem(lua_State* L) { luax_newlib(L, f); luax_registersearcher(L, loader, 1); -- cgit v1.1-26-g67d0