diff options
| author | ruki <[email protected]> | 2025-11-09 23:22:44 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-11-09 23:22:44 +0800 |
| commit | 831447a51da0b094e08bb047247bf269a6e6cf71 (patch) | |
| tree | f345e66e3d9882cbb4d49d588c3080d88bc17cd8 /core/src/xmake/curses | |
| parent | bf2da8a3d7f04bf5ffcdce8fd4c334d5421d3494 (diff) | |
format more if-else
Diffstat (limited to 'core/src/xmake/curses')
| -rw-r--r-- | core/src/xmake/curses/curses.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/core/src/xmake/curses/curses.c b/core/src/xmake/curses/curses.c index 988e6840c..4f8c03028 100644 --- a/core/src/xmake/curses/curses.c +++ b/core/src/xmake/curses/curses.c @@ -105,10 +105,12 @@ static int g_mapkey = 0; * private implementation */ static chtype xm_curses_checkch(lua_State *lua, int index) { - if (lua_type(lua, index) == LUA_TNUMBER) + if (lua_type(lua, index) == LUA_TNUMBER) { return (chtype)luaL_checknumber(lua, index); - if (lua_type(lua, index) == LUA_TSTRING) + } + if (lua_type(lua, index) == LUA_TSTRING) { return *lua_tostring(lua, index); + } #ifdef USE_LUAJIT luaL_typerror(lua, index, "chtype"); #endif @@ -685,26 +687,29 @@ static int xm_curses_napms(lua_State *lua) { } static int xm_curses_cbreak(lua_State *lua) { - if (lua_isnoneornil(lua, 1) || lua_toboolean(lua, 1)) + if (lua_isnoneornil(lua, 1) || lua_toboolean(lua, 1)) { lua_pushboolean(lua, XM_CURSES_OK(cbreak())); - else + } else { lua_pushboolean(lua, XM_CURSES_OK(nocbreak())); + } return 1; } static int xm_curses_echo(lua_State *lua) { - if (lua_isnoneornil(lua, 1) || lua_toboolean(lua, 1)) + if (lua_isnoneornil(lua, 1) || lua_toboolean(lua, 1)) { lua_pushboolean(lua, XM_CURSES_OK(echo())); - else + } else { lua_pushboolean(lua, XM_CURSES_OK(noecho())); + } return 1; } static int xm_curses_nl(lua_State *lua) { - if (lua_isnoneornil(lua, 1) || lua_toboolean(lua, 1)) + if (lua_isnoneornil(lua, 1) || lua_toboolean(lua, 1)) { lua_pushboolean(lua, XM_CURSES_OK(nl())); - else + } else { lua_pushboolean(lua, XM_CURSES_OK(nonl())); + } return 1; } |
