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 LuaJIT #1

Open
dbready opened this issue Jan 12, 2022 · 2 comments
Open

Support LuaJIT #1

dbready opened this issue Jan 12, 2022 · 2 comments
Assignees

Comments

@dbready
Copy link

dbready commented Jan 12, 2022

Amazing project. I love the idea of getting more things into Zig.

I saw you are hosting Lua 5.4 inside the project. Is there anything that would prevent running LuaJIT as an alternative? LuaJIT is a significantly faster runtime (admittedly, if you care about speed you don't use an interpreter language) which would make this even more appealing to me.

Downsides of LuaJIT: no real integers and no built-in UTF8 support, so that could make the interface more complicated.

@ranciere
Copy link
Owner

It's absolutely feasible, a compile-time switch would be the best.

@ranciere ranciere self-assigned this Jan 13, 2022
@Ristovski
Copy link

Ristovski commented Mar 21, 2022

I can confirm that Zoltan works with LuaJIT2.

The way I got this working was by first compiling LuaJIT externally with CC="zig cc" make and then linking the libluajit.a library using exe.addObjectFile("/path/to/libluajit.a");. Do note this also required defining LUAJIT_NO_UNWIND as I wasn't sure how to get libunwind working with Zig.

I also had to make a minor modification inside Zoltan to convert lua_pcallk calls to lua_pcall.

Seeing as LuaJIT has a significantly more complex build system (including invoking custom tools such as buildvm), converting this to a pure zig build will be significant work.

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

3 participants