diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-20 15:15:33 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-20 15:15:33 -0300 |
commit | 099442c41f2cec6122690e6c8f2e11327613e6f6 (patch) | |
tree | 73599b274ea4a9b96906ff8160eeb4a524702a8e /lua.c | |
parent | 27600fe87a6fafdfd4ddddeb390591fe749b480f (diff) | |
download | lua-099442c41f2cec6122690e6c8f2e11327613e6f6.tar.gz lua-099442c41f2cec6122690e6c8f2e11327613e6f6.tar.bz2 lua-099442c41f2cec6122690e6c8f2e11327613e6f6.zip |
better separation between basic types
Diffstat (limited to 'lua.c')
-rw-r--r-- | lua.c | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.c,v 1.59 2001/02/06 18:18:58 roberto Exp roberto $ | 2 | ** $Id: lua.c,v 1.60 2001/02/14 17:19:01 roberto Exp roberto $ |
3 | ** Lua stand-alone interpreter | 3 | ** Lua stand-alone interpreter |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -173,20 +173,24 @@ static int file_input (const char *argv) { | |||
173 | #endif | 173 | #endif |
174 | 174 | ||
175 | 175 | ||
176 | static void show_prompt (void) { | 176 | static const char *get_prompt (int prompt) { |
177 | const char *s; | 177 | if (!prompt) |
178 | lua_getglobal(L, "_PROMPT"); | 178 | return ""; |
179 | s = lua_tostring(L, -1); | 179 | else { |
180 | if (!s) s = PROMPT; | 180 | const char *s; |
181 | fputs(s, stdout); | 181 | lua_getglobal(L, "_PROMPT"); |
182 | lua_pop(L, 1); /* remove global */ | 182 | s = lua_tostring(L, -1); |
183 | if (!s) s = PROMPT; | ||
184 | lua_pop(L, 1); /* remove global */ | ||
185 | return s; | ||
186 | } | ||
183 | } | 187 | } |
184 | 188 | ||
185 | 189 | ||
186 | static void manual_input (int version, int prompt) { | 190 | static void manual_input (int version, int prompt) { |
187 | if (version) print_version(); | 191 | if (version) print_version(); |
188 | for (;;) { | 192 | for (;;) { |
189 | if (prompt) show_prompt(); | 193 | fputs(get_prompt(prompt), stdout); /* show prompt */ |
190 | for(;;) { | 194 | for(;;) { |
191 | char buffer[MAXINPUT]; | 195 | char buffer[MAXINPUT]; |
192 | size_t l; | 196 | size_t l; |