MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / doREPL

Function doREPL

src/Chain/libraries/glua/single_glua_src/main.cpp:418–433  ·  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

416** print any results.
417*/
418static void doREPL(lua_State *L) {
419 int status;
420 const char *oldprogname = progname;
421 progname = NULL; /* no 'progname' on errors in interactive mode */
422 while ((status = loadline(L)) != -1) {
423 if (status == LUA_OK)
424 {
425 status = docall(L, 0, LUA_MULTRET);
426 }
427 if (status == LUA_OK) l_print(L);
428 else report(L, status);
429 }
430 lua_settop(L, 0); /* clear stack */
431 lua_writeline();
432 progname = oldprogname;
433}
434
435/*
436** Push on the stack the contents of table 'arg' from 1 to #arg

Callers 1

pmainFunction · 0.70

Calls 5

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

Tested by

no test coverage detected