You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
I'm not sure if this counts as a bug or a feature request, but I discovered while trying to introduce fennel into my project that the behaviour of Lua's require is different from Sol's require (or perhaps even Lua's luaL_requiref).
When loading the fennel library, you have the option to invoke install() which will add its own searcher to package.searchers.
more info is here, under "Use Lua's built-in require function".
where resources/fenneltest.fnl is simply the following:
(print"hello fennel!")
When I say "doesn't work", what I mean is that Sol's require function seems to be ignoring the searchers added by fennel, and is trying to load fenneltest.fnl as a lua script, leading to obvious syntax errors. Meanwhile, calling require from within Lua behaves as expected, passing it on to the fennel compiler.
If it makes any difference, I'm using CMake 3.29.3 with clang 17, and both sol2 and lua are installed from vcpkg. This is all on Windows.
I have also attached the fennel library I'm using. fennel.txt
The text was updated successfully, but these errors were encountered:
mothfuzz
changed the title
Using libraries which add searchers/loaders
Using libraries which add searchers/loaders from C++
Jun 4, 2024
Another interesting quirk, which has me completely stymied: if I add the 'resources' directory to package.path, and then change require('resources/fenneltest') to simply require('fenneltest'), it fails as it tries to parse a lua script instead of a fennel script.
Here is the code I am using to change package.path from C++:
Hello!
I'm not sure if this counts as a bug or a feature request, but I discovered while trying to introduce fennel into my project that the behaviour of Lua's
require
is different from Sol'srequire
(or perhaps even Lua'sluaL_requiref
).When loading the fennel library, you have the option to invoke
install()
which will add its own searcher topackage.searchers
.more info is here, under "Use Lua's built-in require function".
A minimal example of the code I'm using is here:
where resources/fenneltest.fnl is simply the following:
When I say "doesn't work", what I mean is that Sol's
require
function seems to be ignoring the searchers added by fennel, and is trying to load fenneltest.fnl as a lua script, leading to obvious syntax errors. Meanwhile, callingrequire
from within Lua behaves as expected, passing it on to the fennel compiler.If it makes any difference, I'm using CMake 3.29.3 with clang 17, and both sol2 and lua are installed from vcpkg. This is all on Windows.
I have also attached the fennel library I'm using.
fennel.txt
The text was updated successfully, but these errors were encountered: