-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Hi, I replied to your aniseed issue about (lua ...), since that issue is closed I thought I'd post this here. While you can't use (lua "return ...") at the top level of a fennel file, you can use it inside of a (when ...) and achieve your goal.
(local (ok telescope) (pcall require :telescope))
(when (not ok)
(lua "return nil"))
(print :test)
{: telescope}Although, now that I'm writing this out, this technique will probably break aniseed modules... So perhaps this isn't that helpful...
On the latest aniseed/develop this works fine
(module dotfiles.scratch.testmodule)
(local (ok telescope) (pcall require :non-existant-module))
(when (not ok)
(lua "return nil"))
(print :test)
; requiring this module does not print anything, so code after the when expr
; really isn't being executedCompiled
local _2afile_2a = "fnl/dotfiles/scratch/testmodule.fnl"
local _2amodule_name_2a = "dotfiles.scratch.testmodule"
local _2amodule_2a
do
package.loaded[_2amodule_name_2a] = {}
_2amodule_2a = package.loaded[_2amodule_name_2a]
end
local _2amodule_locals_2a
do
_2amodule_2a["aniseed/locals"] = {}
_2amodule_locals_2a = (_2amodule_2a)["aniseed/locals"]
end
local ok, telescope = pcall(require, "non-existant-module")
if not ok then
return nil
else
end
print("test")
return _2amodule_2a🙂
Metadata
Metadata
Assignees
Labels
No labels