Skip to content

Commit 3ca96d7

Browse files
robbielymannatecraddock
authored andcommitted
fix(build)!: lua_wrapper -> zlua
"lua_wrapper", while descriptive, feels significantly worse than "ziglua". since the Zig project feels strongly that "zig" in the name is redundant, "zlua" feels like a nice middle ground. BREAKING CHANGE: the package and exported module are now named "zlua"; the latter change will require alteration of build.zig files.
1 parent 7bfb3c2 commit 3ca96d7

File tree

4 files changed

+185
-185
lines changed

4 files changed

+185
-185
lines changed

build.zig

+13-13
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ pub fn build(b: *Build) void {
2424
}
2525

2626
// Zig module
27-
const lua_wrapper = b.addModule("lua_wrapper", .{
27+
const zlua = b.addModule("zlua", .{
2828
.root_source_file = b.path("src/lib.zig"),
2929
});
3030

3131
// Expose build configuration to the ziglua module
3232
const config = b.addOptions();
3333
config.addOption(Language, "lang", lang);
3434
config.addOption(bool, "luau_use_4_vector", luau_use_4_vector);
35-
lua_wrapper.addOptions("config", config);
35+
zlua.addOptions("config", config);
3636

3737
if (lang == .luau) {
3838
const vector_size: usize = if (luau_use_4_vector) 4 else 3;
39-
lua_wrapper.addCMacro("LUA_VECTOR_SIZE", b.fmt("{}", .{vector_size}));
39+
zlua.addCMacro("LUA_VECTOR_SIZE", b.fmt("{}", .{vector_size}));
4040
}
4141

4242
const upstream = b.dependency(@tagName(lang), .{});
@@ -53,15 +53,15 @@ pub fn build(b: *Build) void {
5353

5454
switch (lang) {
5555
.luau => {
56-
lua_wrapper.addIncludePath(upstream.path("Common/include"));
57-
lua_wrapper.addIncludePath(upstream.path("Compiler/include"));
58-
lua_wrapper.addIncludePath(upstream.path("Ast/include"));
59-
lua_wrapper.addIncludePath(upstream.path("VM/include"));
56+
zlua.addIncludePath(upstream.path("Common/include"));
57+
zlua.addIncludePath(upstream.path("Compiler/include"));
58+
zlua.addIncludePath(upstream.path("Ast/include"));
59+
zlua.addIncludePath(upstream.path("VM/include"));
6060
},
61-
else => lua_wrapper.addIncludePath(upstream.path("src")),
61+
else => zlua.addIncludePath(upstream.path("src")),
6262
}
6363

64-
lua_wrapper.linkLibrary(lib);
64+
zlua.linkLibrary(lib);
6565

6666
// lib must expose all headers included by these root headers
6767
const c_header_path = switch (lang) {
@@ -84,15 +84,15 @@ pub fn build(b: *Build) void {
8484
.link_libc = c_headers.link_libc,
8585
});
8686

87-
lua_wrapper.addImport("c", ziglua_c);
87+
zlua.addImport("c", ziglua_c);
8888

8989
// Tests
9090
const tests = b.addTest(.{
9191
.root_source_file = b.path("src/tests.zig"),
9292
.target = target,
9393
.optimize = optimize,
9494
});
95-
tests.root_module.addImport("lua_wrapper", lua_wrapper);
95+
tests.root_module.addImport("zlua", zlua);
9696

9797
const run_tests = b.addRunArtifact(tests);
9898
const test_step = b.step("test", "Run ziglua tests");
@@ -115,7 +115,7 @@ pub fn build(b: *Build) void {
115115
.target = target,
116116
.optimize = optimize,
117117
});
118-
exe.root_module.addImport("lua_wrapper", lua_wrapper);
118+
exe.root_module.addImport("zlua", zlua);
119119

120120
const artifact = b.addInstallArtifact(exe, .{});
121121
const exe_step = b.step(b.fmt("install-example-{s}", .{example[0]}), b.fmt("Install {s} example", .{example[0]}));
@@ -151,7 +151,7 @@ pub fn build(b: *Build) void {
151151
.name = "define-zig-types",
152152
.target = target,
153153
});
154-
def_exe.root_module.addImport("lua_wrapper", lua_wrapper);
154+
def_exe.root_module.addImport("zlua", zlua);
155155
var run_def_exe = b.addRunArtifact(def_exe);
156156
run_def_exe.addFileArg(b.path("definitions.lua"));
157157

build.zig.zon

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.{
2-
.name = .lua_wrapper,
3-
.fingerprint = 0xb40fd4eedb02233b, // changing this has security and trust implications
2+
.name = .zlua,
3+
.fingerprint = 0xcf671dd0b696484, // changing this has security and trust implications
44
.version = "0.1.0",
55
.paths = .{ "build.zig", "build.zig.zon", "src", "license", "include", "build" },
66

src/lib.zig

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Similar to the Lua C API documentation, each function has an indicator to describe how interacts with the stack and which errors it may return.
22
//!
3-
//! Instead of using the form `[-o, +p, x]`, Lua_wrapper uses the words **Pops**, **Pushes**, and **Errors** for clarity.
3+
//! Instead of using the form `[-o, +p, x]`, Zlua uses the words **Pops**, **Pushes**, and **Errors** for clarity.
44
//!
55
//! * **Pops**: how many elements the function pops from the stack.
66
//! * **Pushes**: how many elements the function pushes onto the stack.
@@ -302,7 +302,7 @@ pub const DebugInfo = switch (lang) {
302302
.luau => DebugInfoLuau,
303303
};
304304

305-
/// The superset of all errors returned from lua_wrapper
305+
/// The superset of all errors returned from zlua
306306
pub const Error = error{
307307
/// A generic failure (used when a function can only fail in one way)
308308
LuaError,
@@ -750,7 +750,7 @@ pub const Lua = opaque {
750750
/// * Finally you call `Lua.call()`
751751
/// * `args.args` is the number of arguments that you pushed onto the stack. When the function returns, all arguments and
752752
/// the function value are popped and the call results are pushed onto the stack.
753-
/// * The number of results is adjusted to `args.results`, unless `args.results` is `lua_wrapper.mult_return`. In this case, all results from the function are pushed
753+
/// * The number of results is adjusted to `args.results`, unless `args.results` is `zlua.mult_return`. In this case, all results from the function are pushed
754754
/// * Lua takes care that the returned values fit into the stack space, but it does not ensure any extra space in the stack. The function results
755755
/// are pushed onto the stack in direct order (the first result is pushed first), so that after the call the last result is
756756
/// on the top of the stack.
@@ -4903,7 +4903,7 @@ pub const Buffer = struct {
49034903
}
49044904
};
49054905

4906-
// Helper functions to make the lua_wrapper API easier to use
4906+
// Helper functions to make the zlua API easier to use
49074907

49084908
const Tuple = std.meta.Tuple;
49094909

0 commit comments

Comments
 (0)