diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-11-28 13:48:33 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2020-11-28 13:48:33 +0100 |
commit | eb6aca8b4a67ef55108231e71ff29a18a29bf5ae (patch) | |
tree | f891914d25cae2cdaa24392381436a287340651e /src/script/lua_api/l_base.h | |
parent | 8de51dae97aa2fe6ea02e4cf437bfe2b2a38eb06 (diff) | |
parent | f1d72d212a0661588be27003069abf4bd8092e55 (diff) | |
download | dragonfireclient-eb6aca8b4a67ef55108231e71ff29a18a29bf5ae.tar.xz |
Merged Minetest
Diffstat (limited to 'src/script/lua_api/l_base.h')
-rw-r--r-- | src/script/lua_api/l_base.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/script/lua_api/l_base.h b/src/script/lua_api/l_base.h index 0cbee7756..9ba50dabf 100644 --- a/src/script/lua_api/l_base.h +++ b/src/script/lua_api/l_base.h @@ -42,7 +42,6 @@ class Environment; class ServerInventoryManager; class ModApiBase : protected LuaHelper { - public: static ScriptApiBase* getScriptApiBase(lua_State *L); static Server* getServer(lua_State *L); @@ -76,10 +75,18 @@ public: lua_CFunction func, int top); - static int l_deprecated_function(lua_State *L); - static void markAliasDeprecated(luaL_Reg *reg); -private: - // <old_name> = { <new_name>, <new_function> } - static std::unordered_map<std::string, luaL_Reg> m_deprecated_wrappers; - static bool m_error_deprecated_calls; + /** + * A wrapper for deprecated functions. + * + * When called, handles the deprecation according to user settings and then calls `func`. + * + * @throws Lua Error if required by the user settings. + * + * @param L Lua state + * @param good Name of good function/method + * @param bad Name of deprecated function/method + * @param func Actual implementation of function + * @return value from `func` + */ + static int l_deprecated_function(lua_State *L, const char *good, const char *bad, lua_CFunction func); }; |