summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2022-04-03 01:50:45 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2022-04-03 01:50:45 +0200
commit3afce7de56161994dec3e33518f0ccdc0e082331 (patch)
tree0aef4c550b2d0822bab3324587cb48e04a4c3412
parentd4fbb03b40657c0036652eef571256a173ab00e4 (diff)
feat(util): safe loading of plugin
-rw-r--r--fnl/util.fnl10
1 files changed, 10 insertions, 0 deletions
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))))
+