From 3afce7de56161994dec3e33518f0ccdc0e082331 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Sun, 3 Apr 2022 01:50:45 +0200 Subject: feat(util): safe loading of plugin --- fnl/util.fnl | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 fnl/util.fnl diff --git a/fnl/util.fnl b/fnl/util.fnl new file mode 100644 index 0000000..ae52bac --- /dev/null +++ b/fnl/util.fnl @@ -0,0 +1,10 @@ +;; Utility functions. +(module util) + +(defn load-plugin [name] + (let [(ok? val-or-err) (pcall require name)] + (when ok? + (val-or-err)) + (when (not ok?) + (print "Could not load config: " val-or-err)))) + -- cgit v1.2.3-70-g09d2