1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-15 04:15:26 +03:00

Add function name to debug output (#3647)

* Add function name to debug output

* Better english, hopefully :)

* Possible fix for not trying to run background widgets function when it does not exist

* Typos
This commit is contained in:
3djc 2016-07-06 18:41:45 +02:00 committed by Bertrand Songis
parent 53d8a615a0
commit 2f8effb6d1

View file

@ -981,7 +981,7 @@ class LuaWidgetFactory: public WidgetFactory
}
if (lua_pcall(L, 2, 1, 0) != 0) {
TRACE("Error in widget %s: %s", getName(), lua_tostring(L, -1));
TRACE("Error in widget %s create() function: %s", getName(), lua_tostring(L, -1));
}
int widgetData = luaL_ref(L, LUA_REGISTRYINDEX);
Widget * widget = new LuaWidget(this, zone, persistentData, widgetData);
@ -1009,7 +1009,7 @@ void LuaWidget::update() const
}
if (lua_pcall(L, 2, 0, 0) != 0) {
TRACE("Error in widget %s: %s", factory->getName(), lua_tostring(L, -1));
TRACE("Error in widget %s update() function: %s", factory->getName(), lua_tostring(L, -1));
}
}
@ -1020,7 +1020,7 @@ void LuaWidget::refresh()
lua_rawgeti(L, LUA_REGISTRYINDEX, factory->refreshFunction);
lua_rawgeti(L, LUA_REGISTRYINDEX, widgetData);
if (lua_pcall(L, 1, 0, 0) != 0) {
TRACE("Error in widget %s: %s", factory->getName(), lua_tostring(L, -1));
TRACE("Error in widget %s refresh() function: %s", factory->getName(), lua_tostring(L, -1));
}
}
@ -1028,10 +1028,12 @@ void LuaWidget::background()
{
SET_LUA_INSTRUCTIONS_COUNT(PERMANENT_SCRIPTS_MAX_INSTRUCTIONS);
LuaWidgetFactory * factory = (LuaWidgetFactory *)this->factory;
if (factory->backgroundFunction) {
lua_rawgeti(L, LUA_REGISTRYINDEX, factory->backgroundFunction);
lua_rawgeti(L, LUA_REGISTRYINDEX, widgetData);
if (lua_pcall(L, 1, 0, 0) != 0) {
TRACE("Error in widget %s: %s", factory->getName(), lua_tostring(L, -1));
TRACE("Error in widget %s background() function: %s", factory->getName(), lua_tostring(L, -1));
}
}
}