-
Notifications
You must be signed in to change notification settings - Fork 45
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
Expose Luau bytecode loading API, add example #38
Conversation
The example could cover more functionality, like how to call some specific function defined in the bytecode blob. But I guess that can be added in another PR. |
Feel free to share this when you finish! As I mentioned on the other PR, I won't have time to review this week, but thank you for the PR and I'll review it thoroughly soon! |
Here's a preview of what: https://github.com/nurpax/luau-zig-example Longer term, I'd like to be able to auto-generate the Zig->Luau bindings. I did see some work on that here in issues, but rather than using comptime, I think I'll do it in a separate pass in Python. I'm just too slow at writing comptime code and I feel like it'll be easier for me to develop & debug if I can see the generated interface code. |
Update to this PR: https://github.com/natecraddock/ziglua/pull/38/files#r1447697186 I'll change the approach a little bit. |
@natecraddock updated this PR. It's done as far as I'm concerned. |
@nurpax sorry, but I just merged the tests.zig changes, so this will need to be updated a bit. Should be really straightforward. Just move your changes to tests.zig to the new file and then add a I'll hold off on merging the lib.zig files for a bit though |
- Add ziglua.compile for a safer wrapper around c.luau_compile - Add Lua.loadBytecode() - Add example
@natecraddock Updated the PR against the main branch. Ready to merge as far as I'm concerned. If you're not in a hurry with your lib.zig changes, then I could work on the two other Luau specific PRs over the weekend. |
Looks good, thanks for working on this!
Yeah I'm taking a break for now. Merging all of the tests took a lot of effort 😅 |
for #30
This exposes Luau API for loading precompiled Luau bytecode.
I found some information from the Luau repository that indicates bytecode is not intended to be fully backwards/forwards compatible. I think loading bytecode can be justified due to performance reasons (improves start up time) but anyone doing bytecode loading should be prepared to be able to recompile bytecode if they upgrade Luau.
It feels like adding a zig-implementation of luau-compile into Ziglua. It wouldn't be much code since the original luau-compile is pretty straightforward too.
Anyway, I'm working on a little blog post that explains how to use VSCode, Zig and Luau together so that VSCode can perform real-time static type checking of Luau code. It may not be obvious from the docs of any of these components :)