** Return the string to be used as a prompt by the interpreter. Leave ** the string (or nil, if using the default value) on the stack, to keep ** it anchored. */
| 467 | ** it anchored. |
| 468 | */ |
| 469 | static const char *get_prompt (lua_State *L, int firstline) { |
| 470 | if (lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2") == LUA_TNIL) |
| 471 | return (firstline ? LUA_PROMPT : LUA_PROMPT2); /* use the default */ |
| 472 | else { /* apply 'tostring' over the value */ |
| 473 | const char *p = luaL_tolstring(L, -1, NULL); |
| 474 | lua_remove(L, -2); /* remove original value */ |
| 475 | return p; |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | /* mark in error messages for incomplete statements */ |
| 480 | #define EOFMARK "<eof>" |
no test coverage detected