MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / doREPL

Function doREPL

lib/lua/src/lua.c:603–617  ·  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

601** print any results.
602*/
603static void doREPL (lua_State *L) {
604 int status;
605 const char *oldprogname = progname;
606 progname = NULL; /* no 'progname' on errors in interactive mode */
607 lua_initreadline(L);
608 while ((status = loadline(L)) != -1) {
609 if (status == LUA_OK)
610 status = docall(L, 0, LUA_MULTRET);
611 if (status == LUA_OK) l_print(L);
612 else report(L, status);
613 }
614 lua_settop(L, 0); /* clear stack */
615 lua_writeline();
616 progname = oldprogname;
617}
618
619/* }================================================================== */
620

Callers 1

pmainFunction · 0.85

Calls 5

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

Tested by

no test coverage detected