MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / aux_lines

Function aux_lines

third-party/lua-5.5.0/src/liolib.c:365–373  ·  view source on GitHub ↗

** Auxiliary function to create the iteration function for 'lines'. ** The iteration function is a closure over 'io_readline', with ** the following upvalues: ** 1) The file being read (first value in the stack) ** 2) the number of arguments to read ** 3) a boolean, true iff file has to be closed when finished ('toclose') ** *) a variable number of format arguments (rest of the stack) */

Source from the content-addressed store, hash-verified

363** *) a variable number of format arguments (rest of the stack)
364*/
365static void aux_lines (lua_State *L, int toclose) {
366 int n = lua_gettop(L) - 1; /* number of arguments to read */
367 luaL_argcheck(L, n <= MAXARGLINE, MAXARGLINE + 2, "too many arguments");
368 lua_pushvalue(L, 1); /* file */
369 lua_pushinteger(L, n); /* number of arguments to read */
370 lua_pushboolean(L, toclose); /* close/not close file when finished */
371 lua_rotate(L, 2, 3); /* move the three values to their positions */
372 lua_pushcclosure(L, io_readline, 3 + n);
373}
374
375
376static int f_lines (lua_State *L) {

Callers 2

f_linesFunction · 0.70
io_linesFunction · 0.70

Calls 6

lua_gettopFunction · 0.70
lua_pushvalueFunction · 0.70
lua_pushintegerFunction · 0.70
lua_pushbooleanFunction · 0.70
lua_rotateFunction · 0.70
lua_pushcclosureFunction · 0.70

Tested by

no test coverage detected