diff --git a/src/lj_clib.c b/src/lj_clib.c index 937b1258..ff71346a 100644 --- a/src/lj_clib.c +++ b/src/lj_clib.c @@ -185,8 +185,8 @@ static void *clib_loadlib(lua_State *L, const char *name, int global) { DWORD oldwerr = GetLastError(); void *h = (void *)LoadLibraryA(clib_extname(L, name)); - SetLastError(oldwerr); if (!h) clib_error(L, "cannot load module " LUA_QS ": %s", name); + SetLastError(oldwerr); UNUSED(global); return h; }