Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,23 @@ pub fn build(b: *std.Build) void {

// add the ziglua module and lua artifact
exe.addModule("ziglua", ziglua.module("ziglua"));
exe.linkLibrary(ziglua.artifact("lua"));
exe.linkLibrary(ziglua.artifact("lua")); // or "luau" if you're using Luau

}
```

To choose the native Lua implementation (Lua version or use Luau), add a `version` field to the `ziglua` dependency like below:

```zig
const ziglua = b.dependency("ziglua", .{
.target = target,
.optimize = optimize,
.version = @import("ziglua").LuaVersion.luau,
});
exe.addModule("ziglua", ziglua.module("ziglua"));
exe.linkLibrary(ziglua.artifact("luau")); // note: luau instead of lua here for LuaVersion.luau
```

This will compile the Lua C sources and link with your project. The `ziglua` module will now be available in your code. Here is a simple example that pushes and inspects an integer on the Lua stack:

```zig
Expand Down