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

Function doREPL

depends/lua/src/lua.c:405–418  ·  view source on GitHub ↗

** Do the REPL: repeatedly read (load) a line, evaluate (call) it, and ** print any results. */

Source from the content-addressed store, hash-verified

403** print any results.
404*/
405static void doREPL (lua_State *L) {
406 int status;
407 const char *oldprogname = progname;
408 progname = NULL; /* no 'progname' on errors in interactive mode */
409 while ((status = loadline(L)) != -1) {
410 if (status == LUA_OK)
411 status = docall(L, 0, LUA_MULTRET);
412 if (status == LUA_OK) l_print(L);
413 else report(L, status);
414 }
415 lua_settop(L, 0); /* clear stack */
416 lua_writeline();
417 progname = oldprogname;
418}
419
420
421/*

Callers 1

pmainFunction · 0.85

Calls 5

loadlineFunction · 0.85
docallFunction · 0.85
l_printFunction · 0.85
lua_settopFunction · 0.85
reportFunction · 0.70

Tested by

no test coverage detected