Allow lovr.headset.init to fail

with a pcall, like the requires above. so if there
is no matching headset driver, the module is just
turned off.
This commit is contained in:
Nevyn Bengtsson 2020-10-01 22:41:53 +02:00
parent e14db6c671
commit da79a87328
1 changed files with 5 additions and 1 deletions

View File

@ -159,7 +159,11 @@ function lovr.boot()
end
if lovr.headset and lovr.graphics and conf.window then
lovr.headset.init()
local ok, result = pcall(lovr.headset.init)
if not ok then
print(string.format('Warning: Could not load module %q: %s', 'headset', result))
lovr.headset = nil
end
end
lovr.handlers = setmetatable({}, { __index = lovr })