mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix segfault in deprecation logging due to tail call, log by default (#10174)
This commit is contained in:
parent
2dff3dd03f
commit
89dd05fdf3
9 changed files with 71 additions and 80 deletions
|
@ -41,7 +41,6 @@ class Environment;
|
|||
class ServerInventoryManager;
|
||||
|
||||
class ModApiBase : protected LuaHelper {
|
||||
|
||||
public:
|
||||
static ScriptApiBase* getScriptApiBase(lua_State *L);
|
||||
static Server* getServer(lua_State *L);
|
||||
|
@ -75,10 +74,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);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue