4 ms·
So, I don't exactly see how one uses this in an already-embedded Lua. For example, my son knows Lisp, and a bit of Lua because he uses PowderToy, which (to your
by abrax3141 5y ago
So, I don't exactly see how one uses this in an already-embedded Lua. For example, my son knows Lisp, and a bit of Lua because he uses PowderToy, which (to your point) has built-in Lua. So if he wanted to program his Lua extensions to PowerToy in Lisp (Fennel) instead of Lua, how would he go about it, exactly? Compile outside of PT from Lisp to Lua and then load the Lua code into PT, or, run the Fennel Lua code on PT's internal Lua? Either seems clunky. I skimmed the online doc, and there may be someplace that gives guidance on this, but I didn't see it right away. If you can point it out (or, if it doesn't exist, perhaps explain a bit) that would be great. Thanks!
- mattroelle 5y agoHi there! Once you have lua running somewhere you're 90% of the way there. You can do AOT compilation which will output lua code via. fennel -c my-fennel-code.fnl Or you can use the lua package api to automatically load .fnl files via require seamlessly: local fennel = require("fennel") table.insert(package.loaders or package.searchers, fennel.searcher) Enjoy!
- az_reth 5y agoIt seems those are indeed the two options. This link gives details on how to perform either or the other. https://fennel-lang.org/setup#embedding-fennel https://fennel-lang.org/setup#embedding-fennel
- mattroelle 5y agoThe primary maintainer of Fennel, Phil Hagelberg, has put together some brief instructions on how to get Fennel running inside of Powder Toy for you :) https://p.hagelb.org/hello-powdertoy.fnl.html https://p.hagelb.org/hello-powdertoy.fnl.html