MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / luaL_fileresult

Function luaL_fileresult

Libs/sol/sol.hpp:3302–3320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3300}
3301
3302COMPAT53_API int luaL_fileresult(lua_State* L, int stat, const char* fname) {
3303 const char* serr = NULL;
3304 int en = errno; /* calls to Lua API may change this value */
3305 char buf[512] = { 0 };
3306 if (stat) {
3307 lua_pushboolean(L, 1);
3308 return 1;
3309 }
3310 else {
3311 lua_pushnil(L);
3312 serr = compat53_strerror(en, buf, sizeof(buf));
3313 if (fname)
3314 lua_pushfstring(L, "%s: %s", fname, serr);
3315 else
3316 lua_pushstring(L, serr);
3317 lua_pushnumber(L, (lua_Number)en);
3318 return 3;
3319 }
3320}
3321
3322static int compat53_checkmode(lua_State* L, const char* mode, const char* modename, int err) {
3323 if (mode && strchr(mode, modename[0]) == NULL) {

Callers 1

luaL_execresultFunction · 0.85

Calls 1

compat53_strerrorFunction · 0.85

Tested by

no test coverage detected