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

Method installLua

app/src/DataModel/Scripting/ScriptApiCall.cpp:729–743  ·  view source on GitHub ↗

* @brief Installs apiCall() / apiCallList() plus the SerialStudio SDK as Lua globals. */

Source from the content-addressed store, hash-verified

727 * @brief Installs apiCall() / apiCallList() plus the SerialStudio SDK as Lua globals.
728 */
729void DataModel::ScriptApiCall::installLua(lua_State* L, int sourceId)
730{
731 Q_ASSERT(L);
732
733 lua_pushinteger(L, sourceId);
734 lua_pushcclosure(L, luaApiCall, 1);
735 lua_setglobal(L, "apiCall");
736
737 lua_pushcfunction(L, luaApiCallList);
738 lua_setglobal(L, "apiCallList");
739
740 static const QByteArray sdk = loadSdk(QStringLiteral(":/api/SerialStudio.lua"));
741 if (!sdk.isEmpty())
742 (void)luaL_dostring(L, sdk.constData());
743}
744
745/**
746 * @brief Installs apiCall() / apiCallList() into a QJSEngine, reusing the bridge if attached.

Callers

nothing calls this directly

Calls 5

lua_pushintegerFunction · 0.85
lua_pushcclosureFunction · 0.85
lua_setglobalFunction · 0.85
loadSdkFunction · 0.85
isEmptyMethod · 0.80

Tested by

no test coverage detected