diff --git a/build.zig.zon b/build.zig.zon index 05b7979..5f34ffd 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -2,4 +2,5 @@ .name = "ziglua", .description = "Zig bindings for the Lua C API", .version = "0.1.0", + .paths = .{ "" }, } diff --git a/src/ziglua-5.1/lib.zig b/src/ziglua-5.1/lib.zig index 1aaff46..77488e9 100644 --- a/src/ziglua-5.1/lib.zig +++ b/src/ziglua-5.1/lib.zig @@ -300,7 +300,7 @@ pub const Lua = struct { pub fn init(allocator: Allocator) !Lua { // the userdata passed to alloc needs to be a pointer with a consistent address // so we allocate an Allocator struct to hold a copy of the allocator's data - var allocator_ptr = allocator.create(Allocator) catch return error.Memory; + const allocator_ptr = allocator.create(Allocator) catch return error.Memory; allocator_ptr.* = allocator; const state = c.lua_newstate(alloc, allocator_ptr) orelse return error.Memory; diff --git a/src/ziglua-5.1/tests.zig b/src/ziglua-5.1/tests.zig index e4a4ab0..c35d81c 100644 --- a/src/ziglua-5.1/tests.zig +++ b/src/ziglua-5.1/tests.zig @@ -568,7 +568,7 @@ test "dump and load" { const reader = struct { fn inner(l: *Lua, data: *anyopaque) ?[]const u8 { _ = l; - var arr = ziglua.opaqueCast(std.ArrayList(u8), data); + const arr = ziglua.opaqueCast(std.ArrayList(u8), data); return arr.items; } }.inner; diff --git a/src/ziglua-5.2/lib.zig b/src/ziglua-5.2/lib.zig index 7875c7f..40de76a 100644 --- a/src/ziglua-5.2/lib.zig +++ b/src/ziglua-5.2/lib.zig @@ -330,7 +330,7 @@ pub const Lua = struct { pub fn init(allocator: Allocator) !Lua { // the userdata passed to alloc needs to be a pointer with a consistent address // so we allocate an Allocator struct to hold a copy of the allocator's data - var allocator_ptr = allocator.create(Allocator) catch return error.Memory; + const allocator_ptr = allocator.create(Allocator) catch return error.Memory; allocator_ptr.* = allocator; const state = c.lua_newstate(alloc, allocator_ptr) orelse return error.Memory; diff --git a/src/ziglua-5.2/tests.zig b/src/ziglua-5.2/tests.zig index 8e95f0b..cd02432 100644 --- a/src/ziglua-5.2/tests.zig +++ b/src/ziglua-5.2/tests.zig @@ -673,7 +673,7 @@ test "dump and load" { const reader = struct { fn inner(l: *Lua, data: *anyopaque) ?[]const u8 { _ = l; - var arr = ziglua.opaqueCast(std.ArrayList(u8), data); + const arr = ziglua.opaqueCast(std.ArrayList(u8), data); return arr.items; } }.inner; diff --git a/src/ziglua-5.3/lib.zig b/src/ziglua-5.3/lib.zig index 4c05580..4365382 100644 --- a/src/ziglua-5.3/lib.zig +++ b/src/ziglua-5.3/lib.zig @@ -348,7 +348,7 @@ pub const Lua = struct { // the userdata passed to alloc needs to be a pointer with a consistent address // so we allocate an Allocator struct to hold a copy of the allocator's data // TODO: could we just pass a pointer to the init function? - var allocator_ptr = allocator.create(Allocator) catch return error.Memory; + const allocator_ptr = allocator.create(Allocator) catch return error.Memory; allocator_ptr.* = allocator; const state = c.lua_newstate(alloc, allocator_ptr) orelse return error.Memory; diff --git a/src/ziglua-5.3/tests.zig b/src/ziglua-5.3/tests.zig index fea74fe..8bbfd97 100644 --- a/src/ziglua-5.3/tests.zig +++ b/src/ziglua-5.3/tests.zig @@ -581,7 +581,7 @@ test "extra space" { var lua = try Lua.init(testing.allocator); defer lua.deinit(); - var space: *align(1) usize = @ptrCast(lua.getExtraSpace().ptr); + const space: *align(1) usize = @ptrCast(lua.getExtraSpace().ptr); space.* = 1024; // each new thread is initialized with a copy of the extra space from the main thread var thread = lua.newThread(); @@ -714,7 +714,7 @@ test "dump and load" { const reader = struct { fn inner(l: *Lua, data: *anyopaque) ?[]const u8 { _ = l; - var arr = ziglua.opaqueCast(std.ArrayList(u8), data); + const arr = ziglua.opaqueCast(std.ArrayList(u8), data); return arr.items; } }.inner; diff --git a/src/ziglua-5.4/lib.zig b/src/ziglua-5.4/lib.zig index 440ad7c..c357633 100644 --- a/src/ziglua-5.4/lib.zig +++ b/src/ziglua-5.4/lib.zig @@ -351,7 +351,7 @@ pub const Lua = struct { pub fn init(allocator: Allocator) !Lua { // the userdata passed to alloc needs to be a pointer with a consistent address // so we allocate an Allocator struct to hold a copy of the allocator's data - var allocator_ptr = allocator.create(Allocator) catch return error.Memory; + const allocator_ptr = allocator.create(Allocator) catch return error.Memory; allocator_ptr.* = allocator; const state = c.lua_newstate(alloc, allocator_ptr) orelse return error.Memory; @@ -2122,7 +2122,7 @@ fn wrapZigWarnFn(comptime f: ZigWarnFn) CWarnFn { return struct { fn inner(data: ?*anyopaque, msg: [*c]const u8, to_cont: c_int) callconv(.C) void { // warning messages emitted from Lua should be null-terminated for display - var message = std.mem.span(@as([*:0]const u8, @ptrCast(msg))); + const message = std.mem.span(@as([*:0]const u8, @ptrCast(msg))); @call(.always_inline, f, .{ data, message, to_cont != 0 }); } }.inner; diff --git a/src/ziglua-5.4/tests.zig b/src/ziglua-5.4/tests.zig index d18c22e..0b9ac48 100644 --- a/src/ziglua-5.4/tests.zig +++ b/src/ziglua-5.4/tests.zig @@ -622,7 +622,7 @@ test "extra space" { var lua = try Lua.init(testing.allocator); defer lua.deinit(); - var space: *align(1) usize = @ptrCast(lua.getExtraSpace().ptr); + const space: *align(1) usize = @ptrCast(lua.getExtraSpace().ptr); space.* = 1024; // each new thread is initialized with a copy of the extra space from the main thread var thread = lua.newThread(); @@ -755,7 +755,7 @@ test "dump and load" { const reader = struct { fn inner(l: *Lua, data: *anyopaque) ?[]const u8 { _ = l; - var arr = ziglua.opaqueCast(std.ArrayList(u8), data); + const arr = ziglua.opaqueCast(std.ArrayList(u8), data); return arr.items; } }.inner;