* @brief Installs apiCall() / apiCallList() plus the SerialStudio SDK as Lua globals. */
| 727 | * @brief Installs apiCall() / apiCallList() plus the SerialStudio SDK as Lua globals. |
| 728 | */ |
| 729 | void 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. |
nothing calls this directly
no test coverage detected