From 8403e58857b27b8d63750ebe784b2e1be97252bb Mon Sep 17 00:00:00 2001 From: Jeremy Penner Date: Sun, 25 Apr 2021 14:52:45 -0400 Subject: [PATCH] fix crash on startup when luars232 doesn't load --- link/serial.fnl | 2 +- main.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/link/serial.fnl b/link/serial.fnl index c06a7c7..069973a 100644 --- a/link/serial.fnl +++ b/link/serial.fnl @@ -1,5 +1,5 @@ ; using https://github.com/srdgame/librs232 -(local rs232 (require :luars232)) +(local (_ rs232) (pcall #(require :luars232))) (local command (require "core.command")) (fn check [err ...] diff --git a/main.lua b/main.lua index 739f789..e7b4c91 100644 --- a/main.lua +++ b/main.lua @@ -5,7 +5,7 @@ fv = fennel.view pp = function(x) print(fv(x)) end lume = require("lib.lume") -- these set global variables and can't be required after requiring core.strict -luars232 = require("luars232") +_, luars232 = pcall(function () require("luars232") end) _coroutine_resume = coroutine.resume function coroutine.resume(...)