summaryrefslogtreecommitdiff
path: root/src/plugins/scripts/lua
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2012-06-10 23:01:40 +0200
committerSebastien Helleu <flashcode@flashtux.org>2012-06-10 23:01:40 +0200
commit529d12c1dbad36227e622edab95ac176a94dd5d5 (patch)
treef19855397a13190ae55f7d34a7a678aaa4081e99 /src/plugins/scripts/lua
parente25909878e54882515cd926c0a2fbb31df18ffe8 (diff)
downloadweechat-529d12c1dbad36227e622edab95ac176a94dd5d5.zip
scripts: ignore call to "register" (with a warning) if script is already registered
Diffstat (limited to 'src/plugins/scripts/lua')
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index 29668aa11..85a91076b 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -94,6 +94,16 @@ weechat_lua_api_register (lua_State *L)
const char *shutdown_func, *charset;
API_FUNC(0, "register", API_RETURN_ERROR);
+ if (lua_registered_script)
+ {
+ /* script already registered */
+ weechat_printf (NULL,
+ weechat_gettext ("%s%s: script \"%s\" already "
+ "registered (register ignored)"),
+ weechat_prefix ("error"), LUA_PLUGIN_NAME,
+ lua_registered_script->name);
+ API_RETURN_ERROR;
+ }
lua_current_script = NULL;
lua_registered_script = NULL;
if (lua_gettop (lua_current_interpreter) < 7)
@@ -109,6 +119,7 @@ weechat_lua_api_register (lua_State *L)
if (script_search (weechat_lua_plugin, lua_scripts, name))
{
+ /* another script already exists with same name */
weechat_printf (NULL,
weechat_gettext ("%s%s: unable to register script "
"\"%s\" (another script already "