Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for pre-processing #110

Open
makspll opened this issue Apr 5, 2024 · 1 comment
Open

Support for pre-processing #110

makspll opened this issue Apr 5, 2024 · 1 comment
Milestone

Comments

@makspll
Copy link
Owner

makspll commented Apr 5, 2024

There is a large family of languages that transpile to Lua, Teal and Fennel being some of them.

Right now supporting a new transpiled language still likely requires creating a whole new ScriptHost and AssetLoader, what If we instead allowed users to "hook" into the existing asset loader and allow other extensions to be loaded to the same asset?

Are the bevy asset preprocessor flows a good choice for this?

@makspll makspll added this to the 2024 Goals milestone Apr 5, 2024
@knutsoned
Copy link

knutsoned commented Apr 5, 2024

As an example, I started working on a Fennel mod that tries to set up a dedicated Lua context for transpiling inside the AssetReader, then hands off the Lua source to the standard LuaScriptHost in the usual way:

https://github.com/knutsoned/bevy_mod_scripting_fennel

Note: Since the Fennel compiler is just a Lua module, I'm loading its source from a large string and using lazy_static so I only need to do that once. So far this works to load the Fennel source and execute inline functions. There seems to be a bug calling modules defined in the Fennel at the moment.

Assuming the issue can be resolved, this may be a good testbed to try a version where we use a preprocessor. This may also be the right place to note it would be good to be able to AoT compile Fennel for packaging. Ideally, the runtime compiler would be used during dev, and the Fennel source would be precompiled to Lua during a release build, inlined, and loaded directly by a released binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants