CLuaInstance: Add function 'functionDeprecated()' for debug output...

...when a script function is deprecated.


Origin commit data
------------------
Branch: ni/coolstream
Commit: 5136563035
Author: Michael Liebmann <tuxcode.bbg@gmail.com>
Date: 2014-03-16 (Sun, 16 Mar 2014)



------------------
This commit was generated by Migit
This commit is contained in:
Michael Liebmann
2014-03-16 11:57:01 +01:00
parent 0b0b1c144f
commit b7d78cf315
6 changed files with 26 additions and 0 deletions

View File

@@ -741,6 +741,9 @@ ledcontroler.off LED1 & LED2 aus
ledcontroler.on.all LED1 & LED2 an ledcontroler.on.all LED1 & LED2 an
ledcontroler.on.led1 LED1 an ledcontroler.on.led1 LED1 an
ledcontroler.on.led2 LED2 an ledcontroler.on.led2 LED2 an
lua.function_deprecated1 Achtung!
lua.function_deprecated2 Die Funktion
lua.function_deprecated3 ist veraltet,\n bitte nutzen Sie
mainmenu.audioplayer Audioplayer mainmenu.audioplayer Audioplayer
mainmenu.channels Kanalliste mainmenu.channels Kanalliste
mainmenu.clearsectionsd Lösche EPG Cache mainmenu.clearsectionsd Lösche EPG Cache

View File

@@ -741,6 +741,9 @@ ledcontroler.off Led1 & Led2 off
ledcontroler.on.all Led1 & Led2 on ledcontroler.on.all Led1 & Led2 on
ledcontroler.on.led1 Led1 on ledcontroler.on.led1 Led1 on
ledcontroler.on.led2 Led2 on ledcontroler.on.led2 Led2 on
lua.function_deprecated1 Attention!
lua.function_deprecated2 Function
lua.function_deprecated3 is deprecated,\n please use
mainmenu.audioplayer Audioplayer mainmenu.audioplayer Audioplayer
mainmenu.channels Channels mainmenu.channels Channels
mainmenu.clearsectionsd Clear EPG Cache mainmenu.clearsectionsd Clear EPG Cache

View File

@@ -307,6 +307,18 @@ CLuaInstance::~CLuaInstance()
} }
} }
void CLuaInstance::functionDeprecated(lua_State *L, const char* oldFunc, const char* newFunc)
{
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_FUNCTION_DEPRECATED2), oldFunc,
g_Locale->getText(LOCALE_LUA_FUNCTION_DEPRECATED3), newFunc,
ar.short_src, ar.currentline);
}
#define SET_VAR1(NAME) \ #define SET_VAR1(NAME) \
lua_pushinteger(lua, NAME); \ lua_pushinteger(lua, NAME); \
lua_setglobal(lua, #NAME); lua_setglobal(lua, #NAME);

View File

@@ -161,6 +161,8 @@ private:
lua_State* lua; lua_State* lua;
void registerFunctions(); void registerFunctions();
static void functionDeprecated(lua_State *L, const char* oldFunc, const char* newFunc);
static int NewWindow(lua_State *L); static int NewWindow(lua_State *L);
static int PaintBox(lua_State *L); static int PaintBox(lua_State *L);
static int PaintIcon(lua_State *L); static int PaintIcon(lua_State *L);

View File

@@ -768,6 +768,9 @@ typedef enum
LOCALE_LEDCONTROLER_ON_ALL, LOCALE_LEDCONTROLER_ON_ALL,
LOCALE_LEDCONTROLER_ON_LED1, LOCALE_LEDCONTROLER_ON_LED1,
LOCALE_LEDCONTROLER_ON_LED2, LOCALE_LEDCONTROLER_ON_LED2,
LOCALE_LUA_FUNCTION_DEPRECATED1,
LOCALE_LUA_FUNCTION_DEPRECATED2,
LOCALE_LUA_FUNCTION_DEPRECATED3,
LOCALE_MAINMENU_AUDIOPLAYER, LOCALE_MAINMENU_AUDIOPLAYER,
LOCALE_MAINMENU_CHANNELS, LOCALE_MAINMENU_CHANNELS,
LOCALE_MAINMENU_CLEARSECTIONSD, LOCALE_MAINMENU_CLEARSECTIONSD,

View File

@@ -768,6 +768,9 @@ const char * locale_real_names[] =
"ledcontroler.on.all", "ledcontroler.on.all",
"ledcontroler.on.led1", "ledcontroler.on.led1",
"ledcontroler.on.led2", "ledcontroler.on.led2",
"lua.function_deprecated1",
"lua.function_deprecated2",
"lua.function_deprecated3",
"mainmenu.audioplayer", "mainmenu.audioplayer",
"mainmenu.channels", "mainmenu.channels",
"mainmenu.clearsectionsd", "mainmenu.clearsectionsd",