CLuaInstance: Add member paramBoolDeprecated() for info...

...when Boolean parameters are passed as a string or number


Origin commit data
------------------
Branch: ni/coolstream
Commit: 86186e6443
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2014-09-11 (Thu, 11 Sep 2014)



------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2014-09-11 18:15:34 +02:00
parent e657991bef
commit b7518f435f
6 changed files with 26 additions and 1 deletions

View File

@@ -824,6 +824,9 @@ ledcontroler.off LED1 & LED2 aus
ledcontroler.on.all LED1 & LED2 an
ledcontroler.on.led1 LED1 an
ledcontroler.on.led2 LED2 an
lua.boolparam_deprecated1 Achtung!
lua.boolparam_deprecated2 Die Verwendung von Zahl oder String
lua.boolparam_deprecated3 für einen Boolean Parameter ist veraltet.\n Bitte nutzen Sie native Bool Werte zB:
lua.function_deprecated1 Achtung!
lua.function_deprecated2 Die Funktion
lua.function_deprecated3 ist veraltet,\n bitte nutzen Sie

View File

@@ -824,7 +824,10 @@ ledcontroler.off Led1 & Led2 off
ledcontroler.on.all Led1 & Led2 on
ledcontroler.on.led1 Led1 on
ledcontroler.on.led2 Led2 on
lua.function_deprecated1 Attention!
lua.boolparam_deprecated1 Caution!
lua.boolparam_deprecated2 The use of number or string
lua.boolparam_deprecated3 for a Boolean parameter is deprecated.\n Please use native bool values eg.
lua.function_deprecated1 Caution!
lua.function_deprecated2 Function
lua.function_deprecated3 is deprecated,\n please use
mainmenu.audioplayer Audioplayer

View File

@@ -368,6 +368,18 @@ bool CLuaInstance::_luaL_checkbool(lua_State *L, int numArg)
return b;
}
void CLuaInstance::paramBoolDeprecated(lua_State *L, const char* val)
{
lua_Debug ar;
lua_getstack(L, 1, &ar);
lua_getinfo(L, "Sl", &ar);
printf("[Lua Script] \33[1;31m%s\33[0m %s (\33[31m\"%s\"\33[0m)\n %s \33[32mtrue\33[0m.\n (%s:%d)\n",
g_Locale->getText(LOCALE_LUA_BOOLPARAM_DEPRECATED1),
g_Locale->getText(LOCALE_LUA_BOOLPARAM_DEPRECATED2), val,
g_Locale->getText(LOCALE_LUA_BOOLPARAM_DEPRECATED3),
ar.short_src, ar.currentline);
}
void CLuaInstance::functionDeprecated(lua_State *L, const char* oldFunc, const char* newFunc)
{
lua_Debug ar;

View File

@@ -187,6 +187,7 @@ private:
void registerFunctions();
static bool _luaL_checkbool(lua_State *L, int numArg);
static void paramBoolDeprecated(lua_State *L, const char* val1, bool val2);
static void functionDeprecated(lua_State *L, const char* oldFunc, const char* newFunc);
static lua_Unsigned checkMagicMask(lua_Unsigned &col);

View File

@@ -851,6 +851,9 @@ typedef enum
LOCALE_LEDCONTROLER_ON_ALL,
LOCALE_LEDCONTROLER_ON_LED1,
LOCALE_LEDCONTROLER_ON_LED2,
LOCALE_LUA_BOOLPARAM_DEPRECATED1,
LOCALE_LUA_BOOLPARAM_DEPRECATED2,
LOCALE_LUA_BOOLPARAM_DEPRECATED3,
LOCALE_LUA_FUNCTION_DEPRECATED1,
LOCALE_LUA_FUNCTION_DEPRECATED2,
LOCALE_LUA_FUNCTION_DEPRECATED3,

View File

@@ -851,6 +851,9 @@ const char * locale_real_names[] =
"ledcontroler.on.all",
"ledcontroler.on.led1",
"ledcontroler.on.led2",
"lua.boolparam_deprecated1",
"lua.boolparam_deprecated2",
"lua.boolparam_deprecated3",
"lua.function_deprecated1",
"lua.function_deprecated2",
"lua.function_deprecated3",