MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / luaDatasetGetRaw

Function luaDatasetGetRaw

app/src/DataModel/FrameBuilder.cpp:2586–2607  ·  view source on GitHub ↗

* @brief Lua C closure for datasetGetRaw(uniqueId). */

Source from the content-addressed store, hash-verified

2584 * @brief Lua C closure for datasetGetRaw(uniqueId).
2585 */
2586static 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).

Callers

nothing calls this directly

Calls 7

lua_touserdataFunction · 0.85
luaL_checkintegerFunction · 0.85
lua_pushnilFunction · 0.85
lua_pushnumberFunction · 0.85
lua_pushlstringFunction · 0.85
getDatasetRawMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected