* @brief Resolves positional notify* arguments into (channel, title, subtitle). */
| 466 | * @brief Resolves positional notify* arguments into (channel, title, subtitle). |
| 467 | */ |
| 468 | static void resolveLuaArgs( |
| 469 | lua_State* L, int baseIdx, QString& channel, QString& title, QString& subtitle) |
| 470 | { |
| 471 | const int total = lua_gettop(L); |
| 472 | const int remain = total - (baseIdx - 1); |
| 473 | |
| 474 | if (remain <= 1) { |
| 475 | channel = QStringLiteral("Dashboard"); |
| 476 | title = QString::fromUtf8(luaL_optstring(L, baseIdx, "")); |
| 477 | subtitle = QString(); |
| 478 | } else if (remain == 2) { |
| 479 | channel = QStringLiteral("Dashboard"); |
| 480 | title = QString::fromUtf8(luaL_optstring(L, baseIdx, "")); |
| 481 | subtitle = QString::fromUtf8(luaL_optstring(L, baseIdx + 1, "")); |
| 482 | } else { |
| 483 | channel = QString::fromUtf8(luaL_optstring(L, baseIdx, "")); |
| 484 | title = QString::fromUtf8(luaL_optstring(L, baseIdx + 1, "")); |
| 485 | subtitle = QString::fromUtf8(luaL_optstring(L, baseIdx + 2, "")); |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | /** |
| 490 | * @brief Lua C closure that posts a notification event by level integer. |
no test coverage detected