From 7070be09d41e562188c40610764f2459afe3a701 Mon Sep 17 00:00:00 2001 From: Nathan Craddock Date: Sat, 18 Feb 2023 17:02:09 -0700 Subject: [PATCH] feat: rename all *Aux() functions The new names are more clear on the use --- src/ziglua-5.1/lib.zig | 16 ++++++---------- src/ziglua-5.1/tests.zig | 6 +++--- src/ziglua-5.2/lib.zig | 19 +++++++++---------- src/ziglua-5.2/tests.zig | 18 +++++++++--------- src/ziglua-5.3/lib.zig | 18 +++++++++--------- src/ziglua-5.3/tests.zig | 16 ++++++++-------- src/ziglua-5.4/lib.zig | 18 +++++++++--------- src/ziglua-5.4/tests.zig | 16 ++++++++-------- 8 files changed, 61 insertions(+), 66 deletions(-) diff --git a/src/ziglua-5.1/lib.zig b/src/ziglua-5.1/lib.zig index cab0dc7..76c88d5 100644 --- a/src/ziglua-5.1/lib.zig +++ b/src/ziglua-5.1/lib.zig @@ -657,7 +657,6 @@ pub const Lua = struct { /// Calls a function (or callable object) in protected mode /// See https://www.lua.org/manual/5.1/manual.html#lua_pcall pub fn protectedCall(lua: *Lua, num_args: i32, num_results: i32, msg_handler: i32) !void { - // NOTE: it might be good to make the args named struct params? // The translate-c version of lua_pcall does not type-check so we must rewrite it // (macros don't always translate well with translate-c) const ret = c.lua_pcall(lua.state, num_args, num_results, msg_handler); @@ -1229,7 +1228,7 @@ pub const Lua = struct { /// Grows the stack size to top + `size` elements, raising an error if the stack cannot grow to that size /// `msg` is an additional text to go into the error message /// See https://www.lua.org/manual/5.1/manual.html#luaL_checkstack - pub fn checkStackAux(lua: *Lua, size: i32, msg: ?[*:0]const u8) void { + pub fn checkStackErr(lua: *Lua, size: i32, msg: ?[*:0]const u8) void { c.luaL_checkstack(lua.state, size, msg); } @@ -1272,14 +1271,13 @@ pub const Lua = struct { /// Raises an error /// See https://www.lua.org/manual/5.1/manual.html#luaL_error - pub fn raiseErrorAux(lua: *Lua, fmt: [:0]const u8, args: anytype) noreturn { + pub fn raiseErrorStr(lua: *Lua, fmt: [:0]const u8, args: anytype) noreturn { _ = @call(.auto, c.luaL_error, .{ lua.state, fmt.ptr } ++ args); unreachable; } /// Pushes onto the stack the field `e` from the metatable of the object at index `obj` /// and returns the type of the pushed value - /// TODO: possibly return an error if nil /// See https://www.lua.org/manual/5.1/manual.html#luaL_getmetafield pub fn getMetaField(lua: *Lua, obj: i32, field: [:0]const u8) !LuaType { const val_type = @intToEnum(LuaType, c.luaL_getmetafield(lua.state, obj, field.ptr)); @@ -1289,10 +1287,9 @@ pub const Lua = struct { /// Pushes onto the stack the metatable associated with the name `type_name` in the registry /// or nil if there is no metatable associated with that name. Returns the type of the pushed value - /// TODO: return error when type is nil? /// See https://www.lua.org/manual/5.1/manual.html#luaL_getmetatable - pub fn getMetatableAux(lua: *Lua, type_name: [:0]const u8) void { - c.luaL_getmetatable(lua.state, type_name); + pub fn getMetatableRegistry(lua: *Lua, table_name: [:0]const u8) void { + c.luaL_getmetatable(lua.state, table_name); } /// Creates a copy of string `str`, replacing any occurrence of the string `pat` with the string `rep` @@ -1351,7 +1348,7 @@ pub const Lua = struct { /// Creates a new Lua state with an allocator using the default libc allocator /// See https://www.lua.org/manual/5.1/manual.html#luaL_newstate - pub fn newStateAux() !Lua { + pub fn newStateLibc() !Lua { const state = c.luaL_newstate() orelse return error.Memory; return Lua{ .state = state }; } @@ -1416,7 +1413,7 @@ pub const Lua = struct { if (!lua.isTable(-1)) { lua.pop(1); if (c.luaL_findtable(lua.state, globals_index, name, @intCast(c_int, funcs.len))) |_| { - lua.raiseErrorAux("name conflict for module " ++ c.LUA_QS, .{name.ptr}); + lua.raiseErrorStr("name conflict for module " ++ c.LUA_QS, .{name.ptr}); } lua.pushValue(-1); lua.setField(-3, name); @@ -1554,7 +1551,6 @@ pub const Buffer = struct { /// Adds the string to the buffer /// See https://www.lua.org/manual/5.1/manual.html#luaL_addlstring - /// TODO: rename to addBytes pub fn addBytes(buf: *Buffer, str: []const u8) void { c.luaL_addlstring(&buf.b, str.ptr, str.len); } diff --git a/src/ziglua-5.1/tests.zig b/src/ziglua-5.1/tests.zig index 62a8254..40fe427 100644 --- a/src/ziglua-5.1/tests.zig +++ b/src/ziglua-5.1/tests.zig @@ -86,7 +86,7 @@ test "initialization" { try expectError(error.Memory, Lua.newState(failing_alloc, null)); // use the auxiliary library (uses libc realloc and cannot be checked for leaks!) - lua = try Lua.newStateAux(); + lua = try Lua.newStateLibc(); lua.close(); } @@ -273,7 +273,7 @@ test "filling and checking the stack" { try expectError(error.Fail, lua.checkStack(1_000_000)); // this is small enough it won't fail (would raise an error if it did) - lua.checkStackAux(40, null); + lua.checkStackErr(40, null); while (count < 40) : (count += 1) { lua.pushNil(); } @@ -1099,7 +1099,7 @@ test "args and errors" { const raisesError = ziglua.wrap(struct { fn inner(l: *Lua) i32 { - l.raiseErrorAux("some error %s!", .{"zig"}); + l.raiseErrorStr("some error %s!", .{"zig"}); unreachable; } }.inner); diff --git a/src/ziglua-5.2/lib.zig b/src/ziglua-5.2/lib.zig index 2b2b99c..fa7dda3 100644 --- a/src/ziglua-5.2/lib.zig +++ b/src/ziglua-5.2/lib.zig @@ -717,7 +717,6 @@ pub const Lua = struct { } /// Calls a function (or callable object) in protected mode - /// NOTE: it might be good to make the args named struct params? pub fn protectedCall(lua: *Lua, num_args: i32, num_results: i32, msg_handler: i32) !void { // The translate-c version of lua_pcall does not type-check so we must rewrite it // (macros don't always translate well with translate-c) @@ -1321,7 +1320,7 @@ pub const Lua = struct { /// Grows the stack size to top + `size` elements, raising an error if the stack cannot grow to that size /// `msg` is an additional text to go into the error message - pub fn checkStackAux(lua: *Lua, size: i32, msg: ?[*:0]const u8) void { + pub fn checkStackErr(lua: *Lua, size: i32, msg: ?[*:0]const u8) void { c.luaL_checkstack(lua.state, size, msg); } @@ -1369,7 +1368,7 @@ pub const Lua = struct { } /// Raises an error - pub fn raiseErrorAux(lua: *Lua, fmt: [:0]const u8, args: anytype) noreturn { + pub fn raiseErrorStr(lua: *Lua, fmt: [:0]const u8, args: anytype) noreturn { _ = @call(.auto, c.luaL_error, .{ lua.state, fmt.ptr } ++ args); unreachable; } @@ -1396,8 +1395,8 @@ pub const Lua = struct { /// Pushes onto the stack the metatable associated with the name `type_name` in the registry /// or nil if there is no metatable associated with that name. Returns the type of the pushed value /// TODO: return error when type is nil? - pub fn getMetatableAux(lua: *Lua, type_name: [:0]const u8) void { - c.luaL_getmetatable(lua.state, type_name.ptr); + pub fn getMetatableRegistry(lua: *Lua, table_name: [:0]const u8) void { + c.luaL_getmetatable(lua.state, table_name.ptr); } /// Ensures that the value t[`field`], where t is the value at `index`, is a table, and pushes that table onto the stack. @@ -1413,7 +1412,7 @@ pub const Lua = struct { /// Returns the "length" of the value at the given index as a number /// it is equivalent to the '#' operator in Lua - pub fn lenAux(lua: *Lua, index: i32) i64 { + pub fn lenRaiseErr(lua: *Lua, index: i32) i64 { return c.luaL_len(lua.state, index); } @@ -1495,7 +1494,7 @@ pub const Lua = struct { } /// Creates a new Lua state with an allocator using the default libc allocator - pub fn newStateAux() !Lua { + pub fn newStateLibc() !Lua { const state = c.luaL_newstate() orelse return error.Memory; return Lua{ .state = state }; } @@ -1553,7 +1552,7 @@ pub const Lua = struct { /// Registers all functions in the array `fns` into the table on the top of the stack /// All functions are created with `num_upvalues` upvalues pub fn setFuncs(lua: *Lua, funcs: []const FnReg, num_upvalues: i32) void { - lua.checkStackAux(num_upvalues, "too many upvalues"); + lua.checkStackErr(num_upvalues, "too many upvalues"); for (funcs) |f| { if (f.func) |func| { var i: i32 = 0; @@ -1568,7 +1567,7 @@ pub const Lua = struct { /// Sets the metatable of the object on the top of the stack as the metatable associated /// with `table_name` in the registry - pub fn setMetatableAux(lua: *Lua, table_name: [:0]const u8) void { + pub fn setMetatableRegistry(lua: *Lua, table_name: [:0]const u8) void { c.luaL_setmetatable(lua.state, table_name.ptr); } @@ -1580,7 +1579,7 @@ pub const Lua = struct { } /// Converts any Lua value at the given index into a string in a reasonable format - pub fn toBytesAux(lua: *Lua, index: i32) [:0]const u8 { + pub fn toBytesFmt(lua: *Lua, index: i32) [:0]const u8 { var length: usize = undefined; const ptr = c.luaL_tolstring(lua.state, index, &length); return ptr[0..length :0]; diff --git a/src/ziglua-5.2/tests.zig b/src/ziglua-5.2/tests.zig index b2516ca..697aa6f 100644 --- a/src/ziglua-5.2/tests.zig +++ b/src/ziglua-5.2/tests.zig @@ -87,7 +87,7 @@ test "initialization" { try expectError(error.Memory, Lua.newState(failing_alloc, null)); // use the auxiliary library (uses libc realloc and cannot be checked for leaks!) - lua = try Lua.newStateAux(); + lua = try Lua.newStateLibc(); lua.close(); } @@ -346,7 +346,7 @@ test "filling and checking the stack" { try expectError(error.Fail, lua.checkStack(1_000_000)); // this is small enough it won't fail (would raise an error if it did) - lua.checkStackAux(40, null); + lua.checkStackErr(40, null); while (count < 40) : (count += 1) { lua.pushNil(); } @@ -443,7 +443,7 @@ test "string buffers" { b = buffer.prep(); std.mem.copy(u8, b, "defghijklmnopqrstuvwxyz"); buffer.pushResultSize(23); - try expectEqualStrings("abcdefghijklmnopqrstuvwxyz", lua.toBytesAux(-1)); + try expectEqualStrings("abcdefghijklmnopqrstuvwxyz", lua.toBytesFmt(-1)); lua.pop(1); lua.len(-1); @@ -626,7 +626,7 @@ test "table access" { lua.rawSetIndex(-2, index); } try expectEqual(@as(usize, 5), lua.rawLen(-1)); - try expectEqual(@as(Integer, 5), lua.lenAux(-1)); + try expectEqual(@as(Integer, 5), lua.lenRaiseErr(-1)); // add a few more while (index <= 10) : (index += 1) { @@ -1116,7 +1116,7 @@ test "metatables" { try lua.doString("f = function() return 10 end"); try lua.newMetatable("mt"); - _ = lua.getMetatableAux("mt"); + _ = lua.getMetatableRegistry("mt"); try expect(lua.compare(1, 2, .eq)); lua.pop(1); @@ -1125,7 +1125,7 @@ test "metatables" { lua.setField(1, "__len"); lua.newTable(); - lua.setMetatableAux("mt"); + lua.setMetatableRegistry("mt"); try lua.callMeta(-1, "__len"); try expectEqual(@as(Number, 10), try lua.toNumber(-1)); @@ -1285,7 +1285,7 @@ test "args and errors" { const raisesError = ziglua.wrap(struct { fn inner(l: *Lua) i32 { - l.raiseErrorAux("some error %s!", .{"zig"}); + l.raiseErrorStr("some error %s!", .{"zig"}); unreachable; } }.inner); @@ -1361,7 +1361,7 @@ test "userdata" { { var t = lua.newUserdata(Type); - lua.setMetatableAux(@typeName(Type)); + lua.setMetatableRegistry(@typeName(Type)); t.a = 1234; t.b = 3.14; @@ -1392,7 +1392,7 @@ test "userdata" { { var t = lua.newUserdata(Type); - lua.setMetatableAux(@typeName(Type)); + lua.setMetatableRegistry(@typeName(Type)); t.a = 1234; t.b = 3.14; diff --git a/src/ziglua-5.3/lib.zig b/src/ziglua-5.3/lib.zig index 9e207a5..6f05ed4 100644 --- a/src/ziglua-5.3/lib.zig +++ b/src/ziglua-5.3/lib.zig @@ -1382,7 +1382,7 @@ pub const Lua = struct { /// Grows the stack size to top + `size` elements, raising an error if the stack cannot grow to that size /// `msg` is an additional text to go into the error message - pub fn checkStackAux(lua: *Lua, size: i32, msg: ?[*:0]const u8) void { + pub fn checkStackErr(lua: *Lua, size: i32, msg: ?[*:0]const u8) void { c.luaL_checkstack(lua.state, size, msg); } @@ -1425,7 +1425,7 @@ pub const Lua = struct { } /// Raises an error - pub fn raiseErrorAux(lua: *Lua, fmt: [:0]const u8, args: anytype) noreturn { + pub fn raiseErrorStr(lua: *Lua, fmt: [:0]const u8, args: anytype) noreturn { _ = @call(.auto, c.luaL_error, .{ lua.state, fmt.ptr } ++ args); unreachable; } @@ -1452,8 +1452,8 @@ pub const Lua = struct { /// Pushes onto the stack the metatable associated with the name `type_name` in the registry /// or nil if there is no metatable associated with that name. Returns the type of the pushed value /// TODO: return error when type is nil? - pub fn getMetatableAux(lua: *Lua, type_name: [:0]const u8) LuaType { - return @intToEnum(LuaType, c.luaL_getmetatable(lua.state, type_name.ptr)); + pub fn getMetatableRegistry(lua: *Lua, table_name: [:0]const u8) LuaType { + return @intToEnum(LuaType, c.luaL_getmetatable(lua.state, table_name.ptr)); } /// Ensures that the value t[`field`], where t is the value at `index`, is a table, and pushes that table onto the stack. @@ -1469,7 +1469,7 @@ pub const Lua = struct { /// Returns the "length" of the value at the given index as a number /// it is equivalent to the '#' operator in Lua - pub fn lenAux(lua: *Lua, index: i32) i64 { + pub fn lenRaiseErr(lua: *Lua, index: i32) i64 { return c.luaL_len(lua.state, index); } @@ -1551,7 +1551,7 @@ pub const Lua = struct { } /// Creates a new Lua state with an allocator using the default libc allocator - pub fn newStateAux() !Lua { + pub fn newStateLibc() !Lua { const state = c.luaL_newstate() orelse return error.Memory; return Lua{ .state = state }; } @@ -1603,7 +1603,7 @@ pub const Lua = struct { /// Registers all functions in the array `fns` into the table on the top of the stack /// All functions are created with `num_upvalues` upvalues pub fn setFuncs(lua: *Lua, funcs: []const FnReg, num_upvalues: i32) void { - lua.checkStackAux(num_upvalues, "too many upvalues"); + lua.checkStackErr(num_upvalues, "too many upvalues"); for (funcs) |f| { if (f.func) |func| { var i: i32 = 0; @@ -1618,7 +1618,7 @@ pub const Lua = struct { /// Sets the metatable of the object on the top of the stack as the metatable associated /// with `table_name` in the registry - pub fn setMetatableAux(lua: *Lua, table_name: [:0]const u8) void { + pub fn setMetatableRegistry(lua: *Lua, table_name: [:0]const u8) void { c.luaL_setmetatable(lua.state, table_name.ptr); } @@ -1630,7 +1630,7 @@ pub const Lua = struct { } /// Converts any Lua value at the given index into a string in a reasonable format - pub fn toBytesAux(lua: *Lua, index: i32) [:0]const u8 { + pub fn toBytesFmt(lua: *Lua, index: i32) [:0]const u8 { var length: usize = undefined; const ptr = c.luaL_tolstring(lua.state, index, &length); return ptr[0..length :0]; diff --git a/src/ziglua-5.3/tests.zig b/src/ziglua-5.3/tests.zig index c41fb82..112e945 100644 --- a/src/ziglua-5.3/tests.zig +++ b/src/ziglua-5.3/tests.zig @@ -86,7 +86,7 @@ test "initialization" { try expectError(error.Memory, Lua.newState(failing_alloc, null)); // use the auxiliary library (uses libc realloc and cannot be checked for leaks!) - lua = try Lua.newStateAux(); + lua = try Lua.newStateLibc(); lua.close(); } @@ -360,7 +360,7 @@ test "filling and checking the stack" { try expectError(error.Fail, lua.checkStack(1_000_000)); // this is small enough it won't fail (would raise an error if it did) - lua.checkStackAux(40, null); + lua.checkStackErr(40, null); while (count < 40) : (count += 1) { lua.pushNil(); } @@ -470,7 +470,7 @@ test "string buffers" { b = buffer.prep(); std.mem.copy(u8, b, "defghijklmnopqrstuvwxyz"); buffer.pushResultSize(23); - try expectEqualStrings("abcdefghijklmnopqrstuvwxyz", lua.toBytesAux(-1)); + try expectEqualStrings("abcdefghijklmnopqrstuvwxyz", lua.toBytesFmt(-1)); lua.pop(1); lua.len(-1); @@ -651,7 +651,7 @@ test "table access" { lua.setIndex(-2, index); } try expectEqual(@as(ziglua.Unsigned, 5), lua.rawLen(-1)); - try expectEqual(@as(Integer, 5), lua.lenAux(-1)); + try expectEqual(@as(Integer, 5), lua.lenRaiseErr(-1)); // add a few more while (index <= 10) : (index += 1) { @@ -1147,7 +1147,7 @@ test "metatables" { try lua.doString("f = function() return 10 end"); try lua.newMetatable("mt"); - _ = lua.getMetatableAux("mt"); + _ = lua.getMetatableRegistry("mt"); try expect(lua.compare(1, 2, .eq)); lua.pop(1); @@ -1156,7 +1156,7 @@ test "metatables" { lua.setField(1, "__len"); lua.newTable(); - lua.setMetatableAux("mt"); + lua.setMetatableRegistry("mt"); try lua.callMeta(-1, "__len"); try expectEqual(@as(Number, 10), try lua.toNumber(-1)); @@ -1314,7 +1314,7 @@ test "args and errors" { const raisesError = ziglua.wrap(struct { fn inner(l: *Lua) i32 { - l.raiseErrorAux("some error %s!", .{"zig"}); + l.raiseErrorStr("some error %s!", .{"zig"}); unreachable; } }.inner); @@ -1372,7 +1372,7 @@ test "userdata" { try lua.newMetatable(@typeName(Type)); var t = lua.newUserdata(Type); - lua.setMetatableAux(@typeName(Type)); + lua.setMetatableRegistry(@typeName(Type)); t.a = 1234; t.b = 3.14; diff --git a/src/ziglua-5.4/lib.zig b/src/ziglua-5.4/lib.zig index 074403d..66f2c94 100644 --- a/src/ziglua-5.4/lib.zig +++ b/src/ziglua-5.4/lib.zig @@ -1426,7 +1426,7 @@ pub const Lua = struct { /// Grows the stack size to top + `size` elements, raising an error if the stack cannot grow to that size /// `msg` is an additional text to go into the error message - pub fn checkStackAux(lua: *Lua, size: i32, msg: ?[*:0]const u8) void { + pub fn checkStackErr(lua: *Lua, size: i32, msg: ?[*:0]const u8) void { c.luaL_checkstack(lua.state, size, msg); } @@ -1469,7 +1469,7 @@ pub const Lua = struct { } /// Raises an error - pub fn raiseErrorAux(lua: *Lua, fmt: [:0]const u8, args: anytype) noreturn { + pub fn raiseErrorStr(lua: *Lua, fmt: [:0]const u8, args: anytype) noreturn { _ = @call(.auto, c.luaL_error, .{ lua.state, fmt.ptr } ++ args); unreachable; } @@ -1496,8 +1496,8 @@ pub const Lua = struct { /// Pushes onto the stack the metatable associated with the name `type_name` in the registry /// or nil if there is no metatable associated with that name. Returns the type of the pushed value /// TODO: return error when type is nil? - pub fn getMetatableAux(lua: *Lua, type_name: [:0]const u8) LuaType { - return @intToEnum(LuaType, c.luaL_getmetatable(lua.state, type_name.ptr)); + pub fn getMetatableRegistry(lua: *Lua, table_name: [:0]const u8) LuaType { + return @intToEnum(LuaType, c.luaL_getmetatable(lua.state, table_name.ptr)); } /// Ensures that the value t[`field`], where t is the value at `index`, is a table, and pushes that table onto the stack. @@ -1513,7 +1513,7 @@ pub const Lua = struct { /// Returns the "length" of the value at the given index as a number /// it is equivalent to the '#' operator in Lua - pub fn lenAux(lua: *Lua, index: i32) i64 { + pub fn lenRaiseErr(lua: *Lua, index: i32) i64 { return c.luaL_len(lua.state, index); } @@ -1595,7 +1595,7 @@ pub const Lua = struct { } /// Creates a new Lua state with an allocator using the default libc allocator - pub fn newStateAux() !Lua { + pub fn newStateLibc() !Lua { const state = c.luaL_newstate() orelse return error.Memory; return Lua{ .state = state }; } @@ -1652,7 +1652,7 @@ pub const Lua = struct { /// Registers all functions in the array `fns` into the table on the top of the stack /// All functions are created with `num_upvalues` upvalues pub fn setFuncs(lua: *Lua, funcs: []const FnReg, num_upvalues: i32) void { - lua.checkStackAux(num_upvalues, "too many upvalues"); + lua.checkStackErr(num_upvalues, "too many upvalues"); for (funcs) |f| { if (f.func) |func| { var i: i32 = 0; @@ -1667,7 +1667,7 @@ pub const Lua = struct { /// Sets the metatable of the object on the top of the stack as the metatable associated /// with `table_name` in the registry - pub fn setMetatableAux(lua: *Lua, table_name: [:0]const u8) void { + pub fn setMetatableRegistry(lua: *Lua, table_name: [:0]const u8) void { c.luaL_setmetatable(lua.state, table_name.ptr); } @@ -1679,7 +1679,7 @@ pub const Lua = struct { } /// Converts any Lua value at the given index into a string in a reasonable format - pub fn toBytesAux(lua: *Lua, index: i32) [:0]const u8 { + pub fn toBytesFmt(lua: *Lua, index: i32) [:0]const u8 { var length: usize = undefined; const ptr = c.luaL_tolstring(lua.state, index, &length); return ptr[0..length :0]; diff --git a/src/ziglua-5.4/tests.zig b/src/ziglua-5.4/tests.zig index 2ccd4f8..62f7c30 100644 --- a/src/ziglua-5.4/tests.zig +++ b/src/ziglua-5.4/tests.zig @@ -86,7 +86,7 @@ test "initialization" { try expectError(error.Memory, Lua.newState(failing_alloc, null)); // use the auxiliary library (uses libc realloc and cannot be checked for leaks!) - lua = try Lua.newStateAux(); + lua = try Lua.newStateLibc(); lua.close(); } @@ -360,7 +360,7 @@ test "filling and checking the stack" { try expectError(error.Fail, lua.checkStack(1_000_000)); // this is small enough it won't fail (would raise an error if it did) - lua.checkStackAux(40, null); + lua.checkStackErr(40, null); while (count < 40) : (count += 1) { lua.pushNil(); } @@ -487,7 +487,7 @@ test "string buffers" { b = buffer.prep(); std.mem.copy(u8, b, "defghijklmnopqrstuvwxyz"); buffer.pushResultSize(23); - try expectEqualStrings("abcdefghijklmnopqrstuvwxyz", lua.toBytesAux(-1)); + try expectEqualStrings("abcdefghijklmnopqrstuvwxyz", lua.toBytesFmt(-1)); lua.pop(1); lua.len(-1); @@ -688,7 +688,7 @@ test "table access" { lua.setIndex(-2, index); } try expectEqual(@as(ziglua.Unsigned, 5), lua.rawLen(-1)); - try expectEqual(@as(Integer, 5), lua.lenAux(-1)); + try expectEqual(@as(Integer, 5), lua.lenRaiseErr(-1)); // add a few more while (index <= 10) : (index += 1) { @@ -1228,7 +1228,7 @@ test "metatables" { try lua.doString("f = function() return 10 end"); try lua.newMetatable("mt"); - _ = lua.getMetatableAux("mt"); + _ = lua.getMetatableRegistry("mt"); try expect(lua.compare(1, 2, .eq)); lua.pop(1); @@ -1237,7 +1237,7 @@ test "metatables" { lua.setField(1, "__len"); lua.newTable(); - lua.setMetatableAux("mt"); + lua.setMetatableRegistry("mt"); try lua.callMeta(-1, "__len"); try expectEqual(@as(Number, 10), try lua.toNumber(-1)); @@ -1405,7 +1405,7 @@ test "args and errors" { const raisesError = ziglua.wrap(struct { fn inner(l: *Lua) i32 { - l.raiseErrorAux("some error %s!", .{"zig"}); + l.raiseErrorStr("some error %s!", .{"zig"}); unreachable; } }.inner); @@ -1463,7 +1463,7 @@ test "userdata" { try lua.newMetatable(@typeName(Type)); var t = lua.newUserdata(Type, 0); - lua.setMetatableAux(@typeName(Type)); + lua.setMetatableRegistry(@typeName(Type)); t.a = 1234; t.b = 3.14;