From 099442c41f2cec6122690e6c8f2e11327613e6f6 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 20 Feb 2001 15:15:33 -0300 Subject: better separation between basic types --- lua.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'lua.c') diff --git a/lua.c b/lua.c index 2659ea45..6d76d03c 100644 --- a/lua.c +++ b/lua.c @@ -1,5 +1,5 @@ /* -** $Id: lua.c,v 1.59 2001/02/06 18:18:58 roberto Exp roberto $ +** $Id: lua.c,v 1.60 2001/02/14 17:19:01 roberto Exp roberto $ ** Lua stand-alone interpreter ** See Copyright Notice in lua.h */ @@ -173,20 +173,24 @@ static int file_input (const char *argv) { #endif -static void show_prompt (void) { - const char *s; - lua_getglobal(L, "_PROMPT"); - s = lua_tostring(L, -1); - if (!s) s = PROMPT; - fputs(s, stdout); - lua_pop(L, 1); /* remove global */ +static const char *get_prompt (int prompt) { + if (!prompt) + return ""; + else { + const char *s; + lua_getglobal(L, "_PROMPT"); + s = lua_tostring(L, -1); + if (!s) s = PROMPT; + lua_pop(L, 1); /* remove global */ + return s; + } } static void manual_input (int version, int prompt) { if (version) print_version(); for (;;) { - if (prompt) show_prompt(); + fputs(get_prompt(prompt), stdout); /* show prompt */ for(;;) { char buffer[MAXINPUT]; size_t l; -- cgit v1.2.3-55-g6feb