MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / ReadFile

Method ReadFile

src/lua/LuaVFS.cpp:129–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127//============================================================================//
128
129int LuaVFS::ReadFile(lua_State* L) {
130 const char* path = luaL_checkstring(L, 1);
131 std::string modes = luaL_optstring(L, 2, GetReadFilter(path, L));
132 modes = BzVFS::allowModes(modes, L2ES(L)->vfsModes->readAllowed);
133
134 std::string data;
135 if (bzVFS.readFile(path, modes, data)) {
136 lua_pushstdstring(L, data);
137 }
138 else {
139 lua_pushnil(L);
140 }
141 return 1;
142}
143
144
145//============================================================================//

Callers

nothing calls this directly

Calls 5

GetReadFilterFunction · 0.85
L2ESFunction · 0.85
lua_pushstdstringFunction · 0.85
lua_pushnilFunction · 0.50
readFileMethod · 0.45

Tested by

no test coverage detected