Skip to content

Commit be1990d

Browse files
authored
fix: remove Lua.equal with compile error for lua 5.2, 5.3, 5.4 (#118)
* fix: remove `Lua.equal` with compile error for lua 5.2, 5.3, 5.4 `lua_equal` is deprecated in Lua versions 5.2 and later; the same behavior can be achieved with `lua_compare` with the equality flag. this commit makes using `lua_equal` a compile error when `lang` is 5.2, 5.3 or 5.4. in fact, it is already a compile error (since the C header does not expose the function), but making it fail faster with a helpful replacement suggestion seems useful.
1 parent b7ea918 commit be1990d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/lib.zig

+4
Original file line numberDiff line numberDiff line change
@@ -980,6 +980,10 @@ pub const Lua = opaque {
980980
///
981981
/// See https://www.lua.org/manual/5.1/manual.html#lua_equal
982982
pub fn equal(lua: *Lua, index1: i32, index2: i32) bool {
983+
switch (lang) {
984+
.lua52, .lua53, .lua54 => @compileError("lua_equal is deprecated, use Lua.compare with .eq instead"),
985+
else => {},
986+
}
983987
return c.lua_equal(@ptrCast(lua), index1, index2) == 1;
984988
}
985989

0 commit comments

Comments
 (0)