X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=lib-lua%2Fruntime.c;h=f7401e2bbf355ac9d3c55cc1d241d17efbe4b3f9;hb=597020b9829312a50c15784916f473da9e75efd0;hp=ac724aff44e698b745f4a216e80fa6760e0a1992;hpb=05e61a9707a6da5c0bca77aa7c3c019a918494de;p=apps%2Fmadmutt.git 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);