summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/mlua_utils.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2016-02-18 16:44:47 +0000
committerAlexander Lantsev <aunsane@gmail.com>2016-02-18 16:44:47 +0000
commit5c2a6bf8417b1d90d9937114b52d4e95c969dfc2 (patch)
treee771a735559dc7cdd0b441cfa5957e39b116e755 /plugins/MirLua/src/mlua_utils.cpp
parentc9bf09d88ffe7db1c2a3e2cdc3cc3085573cb23c (diff)
MirLua: bug fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@16304 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MirLua/src/mlua_utils.cpp')
-rw-r--r--plugins/MirLua/src/mlua_utils.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/MirLua/src/mlua_utils.cpp b/plugins/MirLua/src/mlua_utils.cpp
index 8b303f0188..8a69605b32 100644
--- a/plugins/MirLua/src/mlua_utils.cpp
+++ b/plugins/MirLua/src/mlua_utils.cpp
@@ -162,6 +162,10 @@ int luaM_totable(lua_State *L)
{
const char *tname = luaL_checkstring(L, 2);
+ char message[256];
+ mir_snprintf(message, "Use %s(...) instead", tname);
+ ObsoleteMethod(L, message);
+
luaL_getmetatable(L, tname);
lua_getfield(L, -1, "__call");
lua_pushvalue(L, 1);
@@ -179,12 +183,12 @@ int luaM_ptr2number(lua_State *L)
void ObsoleteMethod(lua_State *L, const char *message)
{
- lua_Debug info;
- lua_getstack(L, 0, &info);
- lua_getinfo(L, "n", &info);
+ lua_Debug ar;
+ if (lua_getstack(L, 0, &ar) == 0 || lua_getinfo(L, "n", &ar) == 0)
+ return;
char text[512];
- mir_snprintf(text, "%s is obsolete. %s", info.name, message);
+ mir_snprintf(text, "%s is obsolete. %s", ar.name, message);
Log(text);
if (db_get_b(NULL, MODULE, "PopupOnObsolete", 0))
ShowNotification(MODULE, text, MB_OK | MB_ICONWARNING, NULL);