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

Function loadline

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

568** in the top of the stack.
569*/
570static int loadline (lua_State *L) {
571 int status;
572 lua_settop(L, 0);
573 if (!pushline(L, 1))
574 return -1; /* no input */
575 if ((status = addreturn(L)) != LUA_OK) /* 'return ...' did not work? */
576 status = multiline(L); /* try as command, maybe with continuation lines */
577 lua_remove(L, 1); /* remove line from the stack */
578 lua_assert(lua_gettop(L) == 1);
579 return status;
580}
581
582
583/*

Callers 1

doREPLFunction · 0.85

Calls 5

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

Tested by

no test coverage detected