Closed Grazfather closed 2 years ago
This is because you're using fn
over defn
I think. The defn
macro (alongside the module
macro) essentially create and pre-export the final table as the module loads, so you don't need the table at the end. By the time Lua gets to the end of the file it realises a table is already in memory for this module and so will return that to whoever required it.
If you just want to use fn
instead of the defn
macro you will need to return tables like regular Lua / Fennel.
Aha! PEBKAC.
Thanks for the clarification. Switching my utils to use defn
obviates the need to add the table at the end.
With the
module
macro and using the require or autoload key in the macro, I'd expect to not need to put a table at the end of my module, but if I don't, I get this error:My
core/init.fnl
has:and my
core/utils.fnl
has:Uncommenting the last line fixes the issue. Is this expected behaviour? The docs suggest that I shouldn't need to do this anymore.