negrel/zluajit
Zig bindings to LuaJIT C API
871db2c84ecefd70a850e03a6c340214a81739f0.tar.gz
zluajit
- Zig bindings to LuaJIT C APIzluajit
provides high quality, ergonomic, well documented and type-safe
bindings to LuaJIT 5.1/5.2 C API.
Start a new Zig project:
$ zig init
Fetch zlua
and adds it to your build.zig.zon:
$ zig fetch --save=zluajit git+https://github.com/negrel/zluajit
info: resolved to commit e5967404a3314b68cf0d49bd0e01930e72eb67f9
Add this to your build.zig:
const zluajit = b.dependency("zluajit", .{
.target = target,
.optimize = optimize,
});
exe_mod.addImport("zluajit", zluajit.module("zluajit"));
Copy this simple hello world to your main.zig
:
const zluajit = @import("zluajit");
pub fn main() !void {
const state = try zluajit.State.init(.{});
defer state.deinit();
state.openLibs();
try state.doString("print 'hello world'", null);
}
Compile and run:
$ zig build run
hello world
If you want to contribute to zlua
to add a feature or improve the code contact
me at [email protected], open an
issue or make a
pull request.
Please give a :star: if this project helped you!
MIT © Alexandre Negrel