summaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_internal.h
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2020-10-31 18:19:23 +0000
committerGitHub <noreply@github.com>2020-10-31 18:19:23 +0000
commit89dd05fdf35ce465fcc2b3588337f79f818a78aa (patch)
tree8cd34c9435fd0feca4d35184649bc002cc53d260 /src/script/lua_api/l_internal.h
parent2dff3dd03f7ba25f3fab7c360759ddbf93615668 (diff)
downloadminetest-89dd05fdf35ce465fcc2b3588337f79f818a78aa.tar.gz
minetest-89dd05fdf35ce465fcc2b3588337f79f818a78aa.tar.bz2
minetest-89dd05fdf35ce465fcc2b3588337f79f818a78aa.zip
Fix segfault in deprecation logging due to tail call, log by default (#10174)
Diffstat (limited to 'src/script/lua_api/l_internal.h')
-rw-r--r--src/script/lua_api/l_internal.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/script/lua_api/l_internal.h b/src/script/lua_api/l_internal.h
index a86eeaf79..a10c259ba 100644
--- a/src/script/lua_api/l_internal.h
+++ b/src/script/lua_api/l_internal.h
@@ -29,7 +29,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "common/c_internal.h"
#define luamethod(class, name) {#name, class::l_##name}
-#define luamethod_aliased(class, name, alias) {#name, class::l_##name}, {#alias, class::l_##name}
+
+#define luamethod_dep(class, good, bad) \
+ {#bad, [](lua_State *L) -> int { \
+ return l_deprecated_function(L, #bad, #good, &class::l_##good); \
+ }}
+
+#define luamethod_aliased(class, name, alias) \
+ luamethod(class, name), \
+ luamethod_dep(class, name, alias)
+
#define API_FCT(name) registerFunction(L, #name, l_##name, top)
// For future use