MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / io_type

Function io_type

deps/lua/src/liolib.c:57–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55
56
57static int io_type (lua_State *L) {
58 void *ud;
59 luaL_checkany(L, 1);
60 ud = lua_touserdata(L, 1);
61 lua_getfield(L, LUA_REGISTRYINDEX, LUA_FILEHANDLE);
62 if (ud == NULL || !lua_getmetatable(L, 1) || !lua_rawequal(L, -2, -1))
63 lua_pushnil(L); /* not a file */
64 else if (*((FILE **)ud) == NULL)
65 lua_pushliteral(L, "closed file");
66 else
67 lua_pushliteral(L, "file");
68 return 1;
69}
70
71
72static FILE *tofile (lua_State *L) {

Callers

nothing calls this directly

Calls 6

luaL_checkanyFunction · 0.85
lua_touserdataFunction · 0.85
lua_getfieldFunction · 0.85
lua_getmetatableFunction · 0.85
lua_rawequalFunction · 0.85
lua_pushnilFunction · 0.85

Tested by

no test coverage detected