X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-lua%2Fruntime.c;h=f7401e2bbf355ac9d3c55cc1d241d17efbe4b3f9;hp=ac724aff44e698b745f4a216e80fa6760e0a1992;hb=f4a82d92ca0d015424b203887579802f003cfac8;hpb=8a0902af903a4cac207b842efd548d892f9df0d0 diff --git a/lib-lua/runtime.c b/lib-lua/runtime.c index ac724af..f7401e2 100644 --- a/lib-lua/runtime.c +++ b/lib-lua/runtime.c @@ -75,8 +75,21 @@ int luaM_wrap(void (*errfun)(const char *fmt, ...), int status) quadopt_t luaM_checkquadopt(lua_State *Ls, int narg) { const char *s; - int i = luaL_checkinteger(Ls, narg); + int i; + + if (lua_type(Ls, narg) == LUA_TSTRING) { + s = lua_tostring(Ls, narg); + switch (mlua_which_token(s, -1)) { + case LTK_YES: return M_YES; + case LTK_NO: return M_NO; + case LTK_ASK_YES: return M_ASKYES; + case LTK_ASK_NO: return M_ASKNO; + default: + break; + } + } + i = luaL_checkinteger(Ls, narg); if (i & ~3) { s = lua_pushfstring(Ls, "int in [0-3] expected, got %d", i); return luaL_argerror(Ls, narg, s);