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

Function g_iofile

Source/Misc/lua/src/lua.c:12114–12132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12112
12113
12114static int g_iofile (lua_State *L, int f, const char *mode) {
12115if (!lua_isnoneornil(L, 1)) {
12116const char *filename = lua_tostring(L, 1);
12117if (filename) {
12118FILE **pf = newfile(L);
12119*pf = fopen(filename, mode);
12120if (*pf == NULL)
12121fileerror(L, 1, filename);
12122}
12123else {
12124tofile(L); /* check that it's a valid file handle */
12125lua_pushvalue(L, 1);
12126}
12127lua_rawseti(L, LUA_ENVIRONINDEX, f);
12128}
12129/* return current value */
12130lua_rawgeti(L, LUA_ENVIRONINDEX, f);
12131return 1;
12132}
12133
12134
12135static int io_input (lua_State *L) {

Callers 2

io_inputFunction · 0.85
io_outputFunction · 0.85

Calls 6

newfileFunction · 0.85
fileerrorFunction · 0.85
tofileFunction · 0.85
lua_pushvalueFunction · 0.85
lua_rawsetiFunction · 0.85
lua_rawgetiFunction · 0.85

Tested by

no test coverage detected