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

Method injectTableApiLua

app/src/DataModel/FrameBuilder.cpp:2666–2709  ·  view source on GitHub ↗

* @brief Injects tableGet / tableSet / datasetGetRaw / datasetGetFinal into the Lua state as C * closures. */

Source from the content-addressed store, hash-verified

2664 * closures.
2665 */
2666void DataModel::FrameBuilder::injectTableApiLua(lua_State* L)
2667{
2668 Q_ASSERT(L);
2669
2670 m_externalTableApiUsers = true;
2671 m_captureFlagsDirty = true;
2672
2673 lua_pushlightuserdata(L, &m_tableStore);
2674 lua_pushcclosure(L, luaTableGet, 1);
2675 lua_setglobal(L, "tableGet");
2676
2677 lua_pushlightuserdata(L, &m_tableStore);
2678 lua_pushcclosure(L, luaTableSet, 1);
2679 lua_setglobal(L, "tableSet");
2680
2681 lua_pushlightuserdata(L, &m_tableStore);
2682 lua_pushcclosure(L, luaTableHandle, 1);
2683 lua_setglobal(L, "tableHandle");
2684
2685 lua_pushlightuserdata(L, &m_tableStore);
2686 lua_pushcclosure(L, luaTableHandleMany, 1);
2687 lua_setglobal(L, "tableHandleMany");
2688
2689 lua_pushlightuserdata(L, &m_tableStore);
2690 lua_pushcclosure(L, luaTableGetH, 1);
2691 lua_setglobal(L, "tableGetH");
2692
2693 lua_pushlightuserdata(L, &m_tableStore);
2694 lua_pushcclosure(L, luaTableSetH, 1);
2695 lua_setglobal(L, "tableSetH");
2696
2697 lua_pushlightuserdata(L, &m_tableStore);
2698 lua_pushcclosure(L, luaDatasetGetRaw, 1);
2699 lua_setglobal(L, "datasetGetRaw");
2700
2701 lua_pushlightuserdata(L, &m_tableStore);
2702 lua_pushcclosure(L, luaDatasetGetFinal, 1);
2703 lua_setglobal(L, "datasetGetFinal");
2704
2705#ifdef BUILD_COMMERCIAL
2706 lua_pushcfunction(L, luaMqttPublish);
2707 lua_setglobal(L, "mqttPublish");
2708#endif
2709}
2710
2711/**
2712 * @brief Installs the __ss table-API bridge; the SDK prelude exposes the friendly globals.

Callers 4

validateTransformMethod · 0.80
testTransformMethod · 0.80
installAllMethod · 0.80
createStateMethod · 0.80

Calls 3

lua_pushlightuserdataFunction · 0.85
lua_pushcclosureFunction · 0.85
lua_setglobalFunction · 0.85

Tested by

no test coverage detected