diff options
author | ShadowNinja <shadowninja@minetest.net> | 2014-04-27 17:55:49 -0400 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2014-05-07 17:14:23 -0400 |
commit | 1cd512913e4d4ad1fb43d4b6e3d7971bb6c67528 (patch) | |
tree | 8c1e2c708f567656684e89faee4f7c8e6c5ec673 /src/script/lua_api | |
parent | fef2729fd0945601e6772780514ee55fec35b068 (diff) | |
download | minetest-1cd512913e4d4ad1fb43d4b6e3d7971bb6c67528.tar.gz minetest-1cd512913e4d4ad1fb43d4b6e3d7971bb6c67528.tar.bz2 minetest-1cd512913e4d4ad1fb43d4b6e3d7971bb6c67528.zip |
Organize builtin into subdirectories
Diffstat (limited to 'src/script/lua_api')
-rw-r--r-- | src/script/lua_api/l_mainmenu.cpp | 4 | ||||
-rw-r--r-- | src/script/lua_api/l_mainmenu.h | 2 | ||||
-rw-r--r-- | src/script/lua_api/l_server.cpp | 8 | ||||
-rw-r--r-- | src/script/lua_api/l_util.cpp | 14 | ||||
-rw-r--r-- | src/script/lua_api/l_util.h | 3 |
5 files changed, 21 insertions, 10 deletions
diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index 8ee2069b1..226620fc6 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -885,7 +885,7 @@ int ModApiMainMenu::l_extract_zip(lua_State *L) } /******************************************************************************/ -int ModApiMainMenu::l_get_scriptdir(lua_State *L) +int ModApiMainMenu::l_get_mainmenu_path(lua_State *L) { GUIEngine* engine = getGuiEngine(L); assert(engine != 0); @@ -1077,7 +1077,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top) API_FCT(delete_dir); API_FCT(copy_dir); API_FCT(extract_zip); - API_FCT(get_scriptdir); + API_FCT(get_mainmenu_path); API_FCT(show_file_open_dialog); API_FCT(get_version); API_FCT(download_file); diff --git a/src/script/lua_api/l_mainmenu.h b/src/script/lua_api/l_mainmenu.h index b711f2f86..7a9cafd1f 100644 --- a/src/script/lua_api/l_mainmenu.h +++ b/src/script/lua_api/l_mainmenu.h @@ -107,7 +107,7 @@ private: //filesystem - static int l_get_scriptdir(lua_State *L); + static int l_get_mainmenu_path(lua_State *L); static int l_get_modpath(lua_State *L); diff --git a/src/script/lua_api/l_server.cpp b/src/script/lua_api/l_server.cpp index 531d044ef..7770a5ff4 100644 --- a/src/script/lua_api/l_server.cpp +++ b/src/script/lua_api/l_server.cpp @@ -350,14 +350,8 @@ int ModApiServer::l_get_modpath(lua_State *L) { NO_MAP_LOCK_REQUIRED; std::string modname = luaL_checkstring(L, 1); - // Do it - if(modname == "__builtin"){ - std::string path = getServer(L)->getBuiltinLuaPath(); - lua_pushstring(L, path.c_str()); - return 1; - } const ModSpec *mod = getServer(L)->getModSpec(modname); - if(!mod){ + if (!mod) { lua_pushnil(L); return 1; } diff --git a/src/script/lua_api/l_util.cpp b/src/script/lua_api/l_util.cpp index f26a88a93..b30bab292 100644 --- a/src/script/lua_api/l_util.cpp +++ b/src/script/lua_api/l_util.cpp @@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "common/c_content.h" #include "cpp_api/s_async.h" #include "debug.h" +#include "porting.h" #include "log.h" #include "tool.h" #include "settings.h" @@ -274,6 +275,14 @@ int ModApiUtil::l_is_yes(lua_State *L) return 1; } +int ModApiUtil::l_get_builtin_path(lua_State *L) +{ + std::string path = porting::path_share + DIR_DELIM + "builtin"; + lua_pushstring(L, path.c_str()); + return 1; +} + + void ModApiUtil::Initialize(lua_State *L, int top) { API_FCT(debug); @@ -294,6 +303,8 @@ void ModApiUtil::Initialize(lua_State *L, int top) API_FCT(get_password_hash); API_FCT(is_yes); + + API_FCT(get_builtin_path); } void ModApiUtil::InitializeAsync(AsyncEngine& engine) @@ -311,4 +322,7 @@ void ModApiUtil::InitializeAsync(AsyncEngine& engine) ASYNC_API_FCT(write_json); ASYNC_API_FCT(is_yes); + + ASYNC_API_FCT(get_builtin_path); } + diff --git a/src/script/lua_api/l_util.h b/src/script/lua_api/l_util.h index 13357587a..d72978dc6 100644 --- a/src/script/lua_api/l_util.h +++ b/src/script/lua_api/l_util.h @@ -79,6 +79,9 @@ private: // is_yes(arg) static int l_is_yes(lua_State *L); + // get_scriptdir() + static int l_get_builtin_path(lua_State *L); + public: static void Initialize(lua_State *L, int top); |