MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / loadline

Function loadline

xrepo/packages/l/lua/port/lua/src/lua.c:551–561  ·  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

549** in the top of the stack.
550*/
551static int loadline (lua_State *L) {
552 int status;
553 lua_settop(L, 0);
554 if (!pushline(L, 1))
555 return -1; /* no input */
556 if ((status = addreturn(L)) != LUA_OK) /* 'return ...' did not work? */
557 status = multiline(L); /* try as command, maybe with continuation lines */
558 lua_remove(L, 1); /* remove line from the stack */
559 lua_assert(lua_gettop(L) == 1);
560 return status;
561}
562
563
564/*

Callers 1

doREPLFunction · 0.85

Calls 6

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

Tested by

no test coverage detected