* @brief Lua C closure for datasetGetRaw(uniqueId). */
| 2584 | * @brief Lua C closure for datasetGetRaw(uniqueId). |
| 2585 | */ |
| 2586 | static int luaDatasetGetRaw(lua_State* L) |
| 2587 | { |
| 2588 | auto* store = static_cast<DataModel::DataTableStore*>(lua_touserdata(L, lua_upvalueindex(1))); |
| 2589 | Q_ASSERT(store); |
| 2590 | |
| 2591 | const int uid = static_cast<int>(luaL_checkinteger(L, 1)); |
| 2592 | const auto* val = store->getDatasetRaw(uid); |
| 2593 | |
| 2594 | if (!val) { |
| 2595 | lua_pushnil(L); |
| 2596 | return 1; |
| 2597 | } |
| 2598 | |
| 2599 | if (val->isNumeric) { |
| 2600 | lua_pushnumber(L, val->numericValue); |
| 2601 | } else { |
| 2602 | const auto utf8 = val->stringValue.toUtf8(); |
| 2603 | lua_pushlstring(L, utf8.constData(), static_cast<size_t>(utf8.size())); |
| 2604 | } |
| 2605 | |
| 2606 | return 1; |
| 2607 | } |
| 2608 | |
| 2609 | /** |
| 2610 | * @brief Lua C closure for datasetGetFinal(uniqueId). |
nothing calls this directly
no test coverage detected