MCPcopy Create free account
hub / github.com/DFHack/dfhack / dfhack_lineedit

Function dfhack_lineedit

library/LuaTools.cpp:472–497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470}
471
472static int dfhack_lineedit(lua_State *S)
473{
474 lua_settop(S, 2);
475
476 Console *pstream = get_console(S);
477 if (!pstream) {
478 lua_pushnil(S);
479 lua_pushstring(S, "no console");
480 return 2;
481 }
482
483 lua_rawgetp(S, LUA_REGISTRYINDEX, &DFHACK_QUERY_COROTABLE_TOKEN);
484 lua_rawgetp(S, -1, S);
485 bool in_coroutine = !lua_isnil(S, -1);
486 lua_settop(S, 2);
487
488 if (in_coroutine)
489 {
490 lua_pushcfunction(S, yield_helper);
491 lua_pushvalue(S, 1);
492 lua_pushvalue(S, 2);
493 return Lua::TailPCallK<dfhack_lineedit_cont>(S, 2, LUA_MULTRET, 0, 0);
494 }
495
496 return dfhack_lineedit_sync(S, pstream);
497}
498
499/*
500 * Exception handling

Callers

nothing calls this directly

Calls 7

lua_settopFunction · 0.85
get_consoleFunction · 0.85
lua_pushnilFunction · 0.85
lua_pushstringFunction · 0.85
lua_rawgetpFunction · 0.85
lua_pushvalueFunction · 0.85
dfhack_lineedit_syncFunction · 0.85

Tested by

no test coverage detected