Skip to content

Commit f440129

Browse files
committed
Default to empty table for define
1 parent c904380 commit f440129

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

fnl/nfnl/module.fnl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,19 @@
5353
This technique helps you have extremely reloadable modules through Conjure.
5454
You can reload the entire file or induvidual function definitions and the
5555
changes will be reflected in all other modules that depend on this one
56-
without having to reload the dependant modules."
56+
without having to reload the dependant modules.
57+
58+
If the currently loaded value _and_ the base value are both nil then an empty
59+
table is used by default."
5760

5861
(let [loaded (. package.loaded mod-name)]
59-
(if (= (type loaded) (type base))
62+
(if
63+
(and (= nil loaded base))
64+
{}
65+
66+
(= (type loaded) (type base))
6067
loaded
68+
6169
base)))
6270

6371
M

lua/nfnl/module.lua

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)