char buf[STRING];
int i;
- default:
- return luaL_error(L, "read-only or inexistant property '%s'", idx, tk);
-
case LTK_DOTLOCK:
case LTK_SENDMAIL:
case LTK_SHELL:
i = quadopt_parse(val);
if (i < 0)
return luaL_error(L, "invalid quad option value: '%s'", val);
- mlua_regsetq(tk, i);
+ mlua_regseti(tk, i);
return 0;
+
+ case LTK_UNKNOWN:
+ case LTK_count:
+ break;
}
+
+ return luaL_error(L, "read-only or inexistant property '%s'", idx, tk);
}
static int madmutt_get(lua_State *L)
{
const char *idx = luaL_checkstring(L, 2);
- int tk;
-
- switch ((tk = lua_which_token(idx, -1))) {
- default:
- lua_getmetatable(L, 1);
- lua_replace(L, 1);
- lua_rawget(L, 1);
- return 1;
+ enum lua_token tk = lua_which_token(idx, -1);
+ switch (tk) {
case LTK_DOTLOCK:
case LTK_SENDMAIL:
case LTK_SHELL:
+ case LTK_EDITOR:
lua_pushstring(L, mlua_reggets(tk));
+ return 1;
+
+ case LTK_QUIT:
+ switch (mlua_reggeti(tk)) {
+ case M_YES:
+ lua_pushstring(L, "yes");
+ return 1;
+ case M_NO:
+ lua_pushstring(L, "no");
+ return 1;
+ case M_ASKNO:
+ lua_pushstring(L, "ask-no");
+ return 1;
+ case M_ASKYES:
+ lua_pushstring(L, "ask-yes");
+ return 1;
+ default:
+ return 0;
+ }
+
+ case LTK_UNKNOWN:
+ case LTK_count:
break;
}
+ lua_getmetatable(L, 1);
+ lua_replace(L, 1);
+ lua_rawget(L, 1);
return 1;
}
** Contains the path of the \fTmadmutt_dotlock(1)\fP binary to be used by
** Madmutt.
*/
- {"editor", madmutt_init_editor, NULL },
+ { "editor", madmutt_init_editor, NULL },
/*
** .pp
** This variable specifies which editor is used by Madmutt.
** Command to use when spawning a subshell. By default, the user's login
** shell from \fT/etc/passwd\fP is used.
*/
- {"quit", NULL, "yes" }
+ { "quit", NULL, "yes" },
/*
** .pp
** This variable controls whether ``quit'' and ``exit'' actually quit