MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / get_prompt

Function get_prompt

3rd/lua-5.4.3/src/lua.c:443–451  ·  view source on GitHub ↗

** 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. */

Source from the content-addressed store, hash-verified

441** it anchored.
442*/
443static const char *get_prompt (lua_State *L, int firstline) {
444 if (lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2") == LUA_TNIL)
445 return (firstline ? LUA_PROMPT : LUA_PROMPT2); /* use the default */
446 else { /* apply 'tostring' over the value */
447 const char *p = luaL_tolstring(L, -1, NULL);
448 lua_remove(L, -2); /* remove original value */
449 return p;
450 }
451}
452
453/* mark in error messages for incomplete statements */
454#define EOFMARK "<eof>"

Callers 1

pushlineFunction · 0.85

Calls 2

lua_getglobalFunction · 0.85
luaL_tolstringFunction · 0.85

Tested by

no test coverage detected