From 9da3a33e1c68bdb59cd6a48ece67c0451b78b79b Mon Sep 17 00:00:00 2001 From: Mm2PL Date: Thu, 2 Feb 2023 14:41:54 +0100 Subject: [PATCH] Make c2.register_command() return a boolean if it went ok --- src/controllers/plugins/PluginController.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/controllers/plugins/PluginController.cpp b/src/controllers/plugins/PluginController.cpp index b2c79bd92..b5066a984 100644 --- a/src/controllers/plugins/PluginController.cpp +++ b/src/controllers/plugins/PluginController.cpp @@ -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) {