Make c2.register_command() return a boolean if it went ok

This commit is contained in:
Mm2PL 2023-02-02 14:41:54 +01:00
parent 52832b43e5
commit 9da3a33e1c
No known key found for this signature in database
GPG key ID: 94AC9B80EFA15ED9

View file

@ -304,12 +304,13 @@ int luaC2RegisterCommand(lua_State *L)
auto callbackSavedName = QString("c2commandcb-%1").arg(name);
lua_setfield(L, LUA_REGISTRYINDEX, callbackSavedName.toStdString().c_str());
pl->registerCommand(name, callbackSavedName);
auto ok = pl->registerCommand(name, callbackSavedName);
// delete both name and callback
lua_pop(L, 2);
return 0;
lua::push(L, ok);
return 1;
}
int luaC2SendMsg(lua_State *L)
{