MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / aux_lines

Function aux_lines

extlibs/lua/src/liolib.c:349–357  ·  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

347** *) a variable number of format arguments (rest of the stack)
348*/
349static void aux_lines (lua_State *L, int toclose) {
350 int n = lua_gettop(L) - 1; /* number of arguments to read */
351 luaL_argcheck(L, n <= MAXARGLINE, MAXARGLINE + 2, "too many arguments");
352 lua_pushvalue(L, 1); /* file */
353 lua_pushinteger(L, n); /* number of arguments to read */
354 lua_pushboolean(L, toclose); /* close/not close file when finished */
355 lua_rotate(L, 2, 3); /* move the three values to their positions */
356 lua_pushcclosure(L, io_readline, 3 + n);
357}
358
359
360static int f_lines (lua_State *L) {

Callers 2

f_linesFunction · 0.85
io_linesFunction · 0.85

Calls 6

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

Tested by

no test coverage detected