From 3252a55936be25a2ebdc7e531323f4912d6c51cc Mon Sep 17 00:00:00 2001 From: rhy <81539300+rhynomatt@users.noreply.github.com> Date: Sat, 14 Jan 2023 10:25:28 -0300 Subject: [PATCH] identifier: Guard against require error in case socket's missing --- identifier.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/identifier.lua b/identifier.lua index 0caf837..e7352e4 100644 --- a/identifier.lua +++ b/identifier.lua @@ -47,7 +47,7 @@ local _encoding = { --use socket. if that's not loaded, they'll have to provide their own local function _now(time_func, ...) if package.loaded.socket then return package.loaded.socket.gettime(...) end - if require("socket") then return require("socket").gettime(...) end + if pcall(require, "socket") then return require("socket").gettime(...) end if time_func then return time_func(...) end error("assertion failed: socket can't be found and no time function provided") end