diff --git a/src/gui/lua/lua_misc.cpp b/src/gui/lua/lua_misc.cpp index b9c3b8dd3..a1e8be916 100644 --- a/src/gui/lua/lua_misc.cpp +++ b/src/gui/lua/lua_misc.cpp @@ -90,8 +90,14 @@ int CLuaInstMisc::MiscNew(lua_State *L) int CLuaInstMisc::strFind(lua_State *L) { - CLuaMisc *D = MiscCheckData(L, 1); - if (!D) return 0; + /* workaround for deprecated functions */ + CLuaMisc *D; + if (luaL_testudata(L, 1, LUA_CLASSNAME) == NULL) { + D = MiscCheckData(L, 1); + if (!D) return 0; + } + /* CLuaMisc *D = MiscCheckData(L, 1); + if (!D) return 0; */ int numargs = lua_gettop(L); if (numargs < 3) { printf("CLuaInstMisc::%s: not enough arguments (%d, expected 2 (or 3 or 4))\n", __func__, numargs); @@ -124,8 +130,14 @@ int CLuaInstMisc::strFind(lua_State *L) int CLuaInstMisc::strSub(lua_State *L) { - CLuaMisc *D = MiscCheckData(L, 1); - if (!D) return 0; + /* workaround for deprecated functions */ + CLuaMisc *D; + if (luaL_testudata(L, 1, LUA_CLASSNAME) == NULL) { + D = MiscCheckData(L, 1); + if (!D) return 0; + } + /* CLuaMisc *D = MiscCheckData(L, 1); + if (!D) return 0; */ int numargs = lua_gettop(L); if (numargs < 3) { printf("CLuaInstMisc::%s: not enough arguments (%d, expected 2 (or 3))\n", __func__, numargs); @@ -150,8 +162,14 @@ int CLuaInstMisc::strSub(lua_State *L) int CLuaInstMisc::enableInfoClock(lua_State *L) { - CLuaMisc *D = MiscCheckData(L, 1); - if (!D) return 0; + /* workaround for deprecated functions */ + CLuaMisc *D; + if (luaL_testudata(L, 1, LUA_CLASSNAME) == NULL) { + D = MiscCheckData(L, 1); + if (!D) return 0; + } + /* CLuaMisc *D = MiscCheckData(L, 1); + if (!D) return 0; */ bool enable = true; int numargs = lua_gettop(L); if (numargs > 1) @@ -222,8 +240,14 @@ int CLuaInstMisc::isMuted(lua_State *L) int CLuaInstMisc::runScriptExt(lua_State *L) { - CLuaMisc *D = MiscCheckData(L, 1); - if (!D) return 0; + /* workaround for deprecated functions */ + CLuaMisc *D; + if (luaL_testudata(L, 1, LUA_CLASSNAME) == NULL) { + D = MiscCheckData(L, 1); + if (!D) return 0; + } + /* CLuaMisc *D = MiscCheckData(L, 1); + if (!D) return 0; */ int numargs = lua_gettop(L); const char *script = luaL_checkstring(L, 2); std::vector args; @@ -242,8 +266,14 @@ int CLuaInstMisc::runScriptExt(lua_State *L) int CLuaInstMisc::GetRevision(lua_State *L) { - CLuaMisc *D = MiscCheckData(L, 1); - if (!D) return 0; + /* workaround for deprecated functions */ + CLuaMisc *D; + if (luaL_testudata(L, 1, LUA_CLASSNAME) == NULL) { + D = MiscCheckData(L, 1); + if (!D) return 0; + } + /* CLuaMisc *D = MiscCheckData(L, 1); + if (!D) return 0; */ unsigned int rev = 0; std::string hw = ""; #if HAVE_COOL_HARDWARE @@ -257,8 +287,14 @@ int CLuaInstMisc::GetRevision(lua_State *L) int CLuaInstMisc::checkVersion(lua_State *L) { - CLuaMisc *D = MiscCheckData(L, 1); - if (!D) return 0; + /* workaround for deprecated functions */ + CLuaMisc *D; + if (luaL_testudata(L, 1, LUA_CLASSNAME) == NULL) { + D = MiscCheckData(L, 1); + if (!D) return 0; + } + /* CLuaMisc *D = MiscCheckData(L, 1); + if (!D) return 0; */ int numargs = lua_gettop(L); if (numargs < 3) { printf("CLuaInstMisc::%s: not enough arguments (%d, expected 2)\n", __func__, numargs); diff --git a/src/gui/lua/lua_video.cpp b/src/gui/lua/lua_video.cpp index 8d23f9831..5dc3e26cf 100644 --- a/src/gui/lua/lua_video.cpp +++ b/src/gui/lua/lua_video.cpp @@ -85,8 +85,14 @@ int CLuaInstVideo::VideoNew(lua_State *L) int CLuaInstVideo::setBlank(lua_State *L) { - CLuaVideo *D = VideoCheckData(L, 1); - if (!D) return 0; + /* workaround for deprecated functions */ + CLuaVideo *D; + if (luaL_testudata(L, 1, LUA_CLASSNAME) == NULL) { + D = VideoCheckData(L, 1); + if (!D) return 0; + } + /* CLuaVideo *D = VideoCheckData(L, 1); + if (!D) return 0; */ bool enable = true; int numargs = lua_gettop(L); if (numargs > 1) @@ -97,8 +103,14 @@ int CLuaInstVideo::setBlank(lua_State *L) int CLuaInstVideo::ShowPicture(lua_State *L) { - CLuaVideo *D = VideoCheckData(L, 1); - if (!D) return 0; + /* workaround for deprecated functions */ + CLuaVideo *D; + if (luaL_testudata(L, 1, LUA_CLASSNAME) == NULL) { + D = VideoCheckData(L, 1); + if (!D) return 0; + } + /* CLuaVideo *D = VideoCheckData(L, 1); + if (!D) return 0; */ const char *fname = luaL_checkstring(L, 2); CFrameBuffer::getInstance()->showFrame(fname); return 0; @@ -106,16 +118,28 @@ int CLuaInstVideo::ShowPicture(lua_State *L) int CLuaInstVideo::StopPicture(lua_State *L) { - CLuaVideo *D = VideoCheckData(L, 1); - if (!D) return 0; + /* workaround for deprecated functions */ + CLuaVideo *D; + if (luaL_testudata(L, 1, LUA_CLASSNAME) == NULL) { + D = VideoCheckData(L, 1); + if (!D) return 0; + } + /* CLuaVideo *D = VideoCheckData(L, 1); + if (!D) return 0; */ CFrameBuffer::getInstance()->stopFrame(); return 0; } int CLuaInstVideo::PlayFile(lua_State *L) { - CLuaVideo *D = VideoCheckData(L, 1); - if (!D) return 0; + /* workaround for deprecated functions */ + CLuaVideo *D = NULL; + if (luaL_testudata(L, 1, LUA_CLASSNAME) == NULL) { + D = VideoCheckData(L, 1); + if (!D) return 0; + } + /* CLuaVideo *D = VideoCheckData(L, 1); + if (!D) return 0; */ LUA_DEBUG("CLuaInstVideo::%s %d\n", __func__, lua_gettop(L)); int numargs = lua_gettop(L); @@ -155,8 +179,14 @@ int CLuaInstVideo::PlayFile(lua_State *L) int CLuaInstVideo::zapitStopPlayBack(lua_State *L) { - CLuaVideo *D = VideoCheckData(L, 1); - if (!D) return 0; + /* workaround for deprecated functions */ + CLuaVideo *D; + if (luaL_testudata(L, 1, LUA_CLASSNAME) == NULL) { + D = VideoCheckData(L, 1); + if (!D) return 0; + } + /* CLuaVideo *D = VideoCheckData(L, 1); + if (!D) return 0; */ bool stop = true; int numargs = lua_gettop(L); if (numargs > 1) @@ -172,8 +202,14 @@ int CLuaInstVideo::zapitStopPlayBack(lua_State *L) int CLuaInstVideo::channelRezap(lua_State *L) { - CLuaVideo *D = VideoCheckData(L, 1); - if (!D) return 0; + /* workaround for deprecated functions */ + CLuaVideo *D; + if (luaL_testudata(L, 1, LUA_CLASSNAME) == NULL) { + D = VideoCheckData(L, 1); + if (!D) return 0; + } + /* CLuaVideo *D = VideoCheckData(L, 1); + if (!D) return 0; */ CNeutrinoApp::getInstance()->channelRezap(); if (CNeutrinoApp::getInstance()->getMode() == CNeutrinoApp::mode_radio) CFrameBuffer::getInstance()->showFrame("radiomode.jpg"); @@ -182,8 +218,14 @@ int CLuaInstVideo::channelRezap(lua_State *L) int CLuaInstVideo::createChannelIDfromUrl(lua_State *L) { - CLuaVideo *D = VideoCheckData(L, 1); - if (!D) return 0; + /* workaround for deprecated functions */ + CLuaVideo *D; + if (luaL_testudata(L, 1, LUA_CLASSNAME) == NULL) { + D = VideoCheckData(L, 1); + if (!D) return 0; + } + /* CLuaVideo *D = VideoCheckData(L, 1); + if (!D) return 0; */ int numargs = lua_gettop(L); if (numargs < 2) { printf("CLuaInstVideo::%s: no arguments\n", __func__);