win和linux缺库也许不会再闪退了

This commit is contained in:
MrZ626
2020-12-15 15:22:18 +08:00
parent b82e3b873b
commit 1030330add

View File

@@ -21,11 +21,11 @@ do--LOADLIB
function LOADLIB(name) function LOADLIB(name)
local libName=libs[name] local libName=libs[name]
if SYSTEM=="Windows"or SYSTEM=="Linux"then if SYSTEM=="Windows"or SYSTEM=="Linux"then
local success,message=require(libName[SYSTEM]) local r1,r2,r3=pcall(require,libName[SYSTEM])
if success then if r1 and r2 then
return success return r2
else else
LOG.print("Cannot load "..name..": "..message,"warn",COLOR.red) LOG.print("Cannot load "..name..": "..(r2 or r3),"warn",COLOR.red)
end end
elseif SYSTEM=="Android"then elseif SYSTEM=="Android"then
local fs=love.filesystem local fs=love.filesystem
@@ -51,7 +51,7 @@ do--LOADLIB
end end
end end
if not libFunc then if not libFunc then
LOG.print("failed to load "..name,"warn",COLOR.red) LOG.print("Cannot load "..name,"warn",COLOR.red)
return return
end end
return libFunc() return libFunc()