From 2860110c3d2db2e42231b54ae4850ade7cc38801 Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Mon, 16 Nov 2015 13:14:18 +0100 Subject: [PATCH] CLuaInstance: Add script function 'paramDeprecated' Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/35c612178033c2178fbacebd50d61baf21cd835b Author: Michael Liebmann Date: 2015-11-16 (Mon, 16 Nov 2015) --- data/locale/deutsch.locale | 1 + data/locale/english.locale | 1 + src/gui/luainstance.cpp | 12 ++++++++++++ src/gui/luainstance.h | 1 + src/system/locals.h | 1 + src/system/locals_intern.h | 1 + 6 files changed, 17 insertions(+) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index dddcb58dc..d5a7569b8 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -871,6 +871,7 @@ lua.boolparam_deprecated3 für einen Boolean Parameter ist veraltet.\n lua.function_deprecated1 Achtung! lua.function_deprecated2 Die Funktion lua.function_deprecated3 ist veraltet,\n bitte nutzen Sie +lua.parameter_deprecated2 Der Parameter lua.versionscheck1 Ihre Lua API Version ist zu alt lua.versionscheck2 Erforderlich ist mindestens mainmenu.audioplayer Audioplayer diff --git a/data/locale/english.locale b/data/locale/english.locale index 62b4159bf..4c2aba343 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -872,6 +872,7 @@ lua.boolparam_deprecated3 for a Boolean parameter is deprecated.\n lua.function_deprecated1 Caution! lua.function_deprecated2 Function lua.function_deprecated3 is deprecated,\n please use +lua.parameter_deprecated2 Parameter lua.versionscheck1 Your Lua API version is too old lua.versionscheck2 This requires at least mainmenu.audioplayer Audioplayer diff --git a/src/gui/luainstance.cpp b/src/gui/luainstance.cpp index c8d82164d..8255491b7 100644 --- a/src/gui/luainstance.cpp +++ b/src/gui/luainstance.cpp @@ -418,6 +418,18 @@ void CLuaInstance::functionDeprecated(lua_State *L, const char* oldFunc, const c ar.short_src, ar.currentline); } +void CLuaInstance::paramDeprecated(lua_State *L, const char* oldParam, const char* newParam) +{ + lua_Debug ar; + lua_getstack(L, 1, &ar); + lua_getinfo(L, "Sl", &ar); + printf("[Lua Script] \33[1;31m%s\33[0m %s \33[33m%s\33[0m %s \33[1;33m%s\33[0m.\n (%s:%d)\n", + g_Locale->getText(LOCALE_LUA_FUNCTION_DEPRECATED1), + g_Locale->getText(LOCALE_LUA_PARAMETER_DEPRECATED2), oldParam, + g_Locale->getText(LOCALE_LUA_FUNCTION_DEPRECATED3), newParam, + ar.short_src, ar.currentline); +} + lua_Unsigned CLuaInstance::checkMagicMask(lua_Unsigned &col) { if ((col & MAGIC_MASK) == MAGIC_COLOR) diff --git a/src/gui/luainstance.h b/src/gui/luainstance.h index 99bd0b4b0..f0983d96a 100644 --- a/src/gui/luainstance.h +++ b/src/gui/luainstance.h @@ -212,6 +212,7 @@ private: static bool _luaL_checkbool(lua_State *L, int numArg); static void paramBoolDeprecated(lua_State *L, const char* val); static void functionDeprecated(lua_State *L, const char* oldFunc, const char* newFunc); + static void paramDeprecated(lua_State *L, const char* oldParam, const char* newParam); static lua_Unsigned checkMagicMask(lua_Unsigned &col); static int NewWindow(lua_State *L); diff --git a/src/system/locals.h b/src/system/locals.h index fdde7dc29..90d0f0c7a 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -899,6 +899,7 @@ typedef enum LOCALE_LUA_FUNCTION_DEPRECATED1, LOCALE_LUA_FUNCTION_DEPRECATED2, LOCALE_LUA_FUNCTION_DEPRECATED3, + LOCALE_LUA_PARAMETER_DEPRECATED2, LOCALE_LUA_VERSIONSCHECK1, LOCALE_LUA_VERSIONSCHECK2, LOCALE_MAINMENU_AUDIOPLAYER, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index a498b74e9..b8591696b 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -899,6 +899,7 @@ const char * locale_real_names[] = "lua.function_deprecated1", "lua.function_deprecated2", "lua.function_deprecated3", + "lua.parameter_deprecated2", "lua.versionscheck1", "lua.versionscheck2", "mainmenu.audioplayer",