aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/term.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/term.c b/src/term.c
index e557a11..10b3e25 100644
--- a/src/term.c
+++ b/src/term.c
@@ -309,6 +309,7 @@ static HANDLE get_console_handle(lua_State *L, int flags_optional)
309// Lua error if the file is not one of these. 309// Lua error if the file is not one of these.
310static int get_console_handle(lua_State *L) 310static int get_console_handle(lua_State *L)
311{ 311{
312printf("get_console_handle\n");
312 FILE **file = (FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE); 313 FILE **file = (FILE **)luaL_checkudata(L, 1, LUA_FILEHANDLE);
313 if (file == NULL || *file == NULL) { 314 if (file == NULL || *file == NULL) {
314 return luaL_argerror(L, 1, "expected file handle"); // call doesn't return 315 return luaL_argerror(L, 1, "expected file handle"); // call doesn't return
@@ -375,9 +376,12 @@ static int lst_setconsoleflags(lua_State *L)
375 return 2; 376 return 2;
376 } 377 }
377 378
378#endif 379#else
379 lua_pushboolean(L, 1); 380 get_console_handle(L); // to validate args
381 lua_pushboolean(L, 1); // always return true on Posix
380 return 1; 382 return 1;
383
384#endif
381} 385}
382 386
383 387
@@ -417,6 +421,8 @@ static int lst_getconsoleflags(lua_State *L)
417 lua_pushliteral(L, "failed to get console mode"); 421 lua_pushliteral(L, "failed to get console mode");
418 return 2; 422 return 2;
419 } 423 }
424#else
425 get_console_handle(L); // to validate args
420 426
421#endif 427#endif
422 lsbf_pushbitflags(L, console_mode); 428 lsbf_pushbitflags(L, console_mode);