MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / f_seek

Function f_seek

Source/Misc/lua/src/lua.c:12353–12366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12351
12352
12353static int f_seek (lua_State *L) {
12354static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END};
12355static const char *const modenames[] = {"set", "cur", "end", NULL};
12356FILE *f = tofile(L);
12357int op = luaL_checkoption(L, 2, "cur", modenames);
12358long offset = luaL_optlong(L, 3, 0);
12359op = fseek(f, offset, mode[op]);
12360if (op)
12361return pushresult(L, 0, NULL); /* error */
12362else {
12363lua_pushinteger(L, ftell(f));
12364return 1;
12365}
12366}
12367
12368
12369static int f_setvbuf (lua_State *L) {

Callers

nothing calls this directly

Calls 4

tofileFunction · 0.85
luaL_checkoptionFunction · 0.85
pushresultFunction · 0.85
lua_pushintegerFunction · 0.85

Tested by

no test coverage detected