diff --git a/sol/compatibility/5.x.x.inl b/sol/compatibility/5.x.x.inl index 04f66215..30154e74 100644 --- a/sol/compatibility/5.x.x.inl +++ b/sol/compatibility/5.x.x.inl @@ -307,11 +307,13 @@ inline int luaL_fileresult(lua_State *L, int stat, const char *fname) { return 1; } else { + char buf[1024]; + strerror_s(buf, 1024, en); lua_pushnil(L); if (fname) - lua_pushfstring(L, "%s: %s", fname, strerror(en)); + lua_pushfstring(L, "%s: %s", fname, buf); else - lua_pushstring(L, strerror(en)); + lua_pushstring(L, buf); lua_pushnumber(L, (lua_Number)en); return 3; } diff --git a/tests.cpp b/tests.cpp index 311c5f60..7ddfaa80 100644 --- a/tests.cpp +++ b/tests.cpp @@ -504,7 +504,6 @@ TEST_CASE("advanced/call_lambdas", "A C++ lambda is exposed to lua and called") REQUIRE(x == 9); } - TEST_CASE("advanced/call_referenced_obj", "A C++ object is passed by pointer/reference_wrapper to lua and invoked") { sol::state lua;