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

Function luaL_fileresult

extlibs/sol3/include/sol/sol.hpp:2785–2803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2783}
2784
2785COMPAT53_API int luaL_fileresult(lua_State *L, int stat, const char *fname) {
2786 const char *serr = NULL;
2787 int en = errno; /* calls to Lua API may change this value */
2788 char buf[512] = { 0 };
2789 if (stat) {
2790 lua_pushboolean(L, 1);
2791 return 1;
2792 }
2793 else {
2794 lua_pushnil(L);
2795 serr = compat53_strerror(en, buf, sizeof(buf));
2796 if (fname)
2797 lua_pushfstring(L, "%s: %s", fname, serr);
2798 else
2799 lua_pushstring(L, serr);
2800 lua_pushnumber(L, (lua_Number)en);
2801 return 3;
2802 }
2803}
2804
2805static int compat53_checkmode(lua_State *L, const char *mode, const char *modename, int err) {
2806 if (mode && strchr(mode, modename[0]) == NULL) {

Callers 1

luaL_execresultFunction · 0.70

Calls 6

lua_pushbooleanFunction · 0.85
lua_pushnilFunction · 0.85
compat53_strerrorFunction · 0.85
lua_pushfstringFunction · 0.85
lua_pushstringFunction · 0.85
lua_pushnumberFunction · 0.85

Tested by

no test coverage detected