diff options
author | chai <chaifix@163.com> | 2018-10-25 08:18:13 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-10-25 08:18:13 +0800 |
commit | 7322a090355af1989d7a1de0de431b6c89844fe2 (patch) | |
tree | c164a05b263007e18cc1c83c8183023d6a19ef82 /src/lua/modules/filesystem/je_lua_filesystem.cpp | |
parent | f889c9c20fc09f26eb8a70674c1d60181835c38a (diff) |
*增加lua导出宏
Diffstat (limited to 'src/lua/modules/filesystem/je_lua_filesystem.cpp')
-rw-r--r-- | src/lua/modules/filesystem/je_lua_filesystem.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
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 <string> @@ -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); |