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

Function luaApiCallList

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

* @brief Lua C closure that returns the array of registered API command names. */

Source from the content-addressed store, hash-verified

694 * @brief Lua C closure that returns the array of registered API command names.
695 */
696static int luaApiCallList(lua_State* L)
697{
698 const auto& commands = API::CommandRegistry::instance().commands();
699 lua_createtable(L, commands.size(), 0);
700
701 int i = 1;
702 for (auto it = commands.constBegin(); it != commands.constEnd(); ++it) {
703 const QByteArray name = it.key().toUtf8();
704 lua_pushlstring(L, name.constData(), static_cast<size_t>(name.size()));
705 lua_rawseti(L, -2, i++);
706 }
707 return 1;
708}
709
710//--------------------------------------------------------------------------------------------------
711// Public installation entry points

Callers

nothing calls this directly

Calls 5

lua_createtableFunction · 0.85
lua_pushlstringFunction · 0.85
lua_rawsetiFunction · 0.85
keyMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected