From da79a8732856ad3e5ae153284a6ea9f6901a3e28 Mon Sep 17 00:00:00 2001 From: Nevyn Bengtsson Date: Thu, 1 Oct 2020 22:41:53 +0200 Subject: [PATCH] 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. --- src/resources/boot.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/resources/boot.lua b/src/resources/boot.lua index 5c31cef9..b9ac3550 100644 --- a/src/resources/boot.lua +++ b/src/resources/boot.lua @@ -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 })