From 8edcb292cb78077b1391468914e1fee9d79620e2 Mon Sep 17 00:00:00 2001 From: Miciah Dashiel Butler Masters Date: Sat, 17 Dec 2005 00:31:45 +0000 Subject: [PATCH] In l_set_option, use lua_toboolean for boolean options instead of lua_tonumber. Now set_option(opt, not get_option(opt)) will always work to toggle a boolean option. --- src/scripting/lua/core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/scripting/lua/core.c b/src/scripting/lua/core.c index 605f75ca0..69ecf0e7a 100644 --- a/src/scripting/lua/core.c +++ b/src/scripting/lua/core.c @@ -493,6 +493,14 @@ l_set_option(LS) /* Set option */ switch (opt->type) { case OPT_BOOL: + { + int value; + + value = lua_toboolean(S, 2); + option_types[opt->type].set(opt, (unsigned char *) (&value)); + break; + } + case OPT_INT: case OPT_LONG: {