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

Function loadline

src/Chain/libraries/glua/lrepl.cpp:415–425  ·  view source on GitHub ↗

** Read a line and try to load (compile) it first as an expression (by ** adding "return " in front of it) and second as a statement. Return ** the final status of load/call with the resulting function (if any) ** in the top of the stack. */

Source from the content-addressed store, hash-verified

413** in the top of the stack.
414*/
415static int loadline(lua_State *L) {
416 int status;
417 lua_settop(L, 0);
418 if (!pushline(L, 1))
419 return -1; /* no input */
420 if ((status = addreturn(L)) != LUA_OK) /* 'return ...' did not work? */
421 status = multiline(L); /* try as command, maybe with continuation lines */
422 lua_remove(L, 1); /* remove line from the stack */
423 lua_assert(lua_gettop(L) == 1);
424 return status;
425}
426
427/*
428** Do the REPL: repeatedly read (load) a line, evaluate (call) it, and

Callers 1

luaL_doREPLFunction · 0.70

Calls 5

lua_settopFunction · 0.85
lua_gettopFunction · 0.85
pushlineFunction · 0.70
addreturnFunction · 0.70
multilineFunction · 0.70

Tested by

no test coverage detected