Allow nil in main.command to delete command
authorMyhailo Danylenko <isbear@ukrpost.net>
Sun, 04 Apr 2010 20:53:32 +0300
changeset 105 bc3201298e52
parent 104 626ff4f83519
child 106 c60fe499f075
Allow nil in main.command to delete command
lua.c
--- a/lua.c	Sun Apr 04 16:44:27 2010 +0300
+++ b/lua.c	Sun Apr 04 20:53:32 2010 +0300
@@ -995,7 +995,7 @@
 	const char             *name = luaL_checkstring (L, 1); // XXX: to_utf8? looks like no :/
 	lua_command_callback_t *cb;
 	int                     top  = lua_gettop (L);
-	if (top > 1) { // Register
+	if (top > 1 && !(top == 2 && lua_isnil (L, 2))) { // Register
 		guint cid = 0;
 		int parse = 0;
 		luaL_argcheck (L, lua_isfunction (L, 2), 2, "function expected");