Skip to content

Commit b6dec0d

Browse files
committed
feat: rename gSub -> globalSub
1 parent 5505a3e commit b6dec0d

File tree

8 files changed

+12
-13
lines changed

8 files changed

+12
-13
lines changed

src/ziglua-5.1/lib.zig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,8 +1298,7 @@ pub const Lua = struct {
12981298
/// Creates a copy of string `str`, replacing any occurrence of the string `pat` with the string `rep`
12991299
/// Pushes the resulting string on the stack and returns it.
13001300
/// See https://www.lua.org/manual/5.1/manual.html#luaL_gsub
1301-
/// TODO: rename to globalSub
1302-
pub fn gSub(lua: *Lua, str: [:0]const u8, pat: [:0]const u8, rep: [:0]const u8) [:0]const u8 {
1301+
pub fn globalSub(lua: *Lua, str: [:0]const u8, pat: [:0]const u8, rep: [:0]const u8) [:0]const u8 {
13031302
return std.mem.span(c.luaL_gsub(lua.state, str.ptr, pat.ptr, rep.ptr));
13041303
}
13051304

src/ziglua-5.1/tests.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -995,11 +995,11 @@ test "checkOption" {
995995
try expectEqualStrings("bad argument #1 to '?' (invalid option 'unknown')", try lua.toBytes(-1));
996996
}
997997

998-
test "gSub" {
998+
test "globalSub" {
999999
var lua = try Lua.init(testing.allocator);
10001000
defer lua.deinit();
10011001

1002-
_ = lua.gSub("-gity -!", "-", "zig");
1002+
_ = lua.globalSub("-gity -!", "-", "zig");
10031003
try expectEqualStrings("ziggity zig!", try lua.toBytes(-1));
10041004
}
10051005

src/ziglua-5.2/lib.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@ pub const Lua = struct {
14071407

14081408
/// Creates a copy of string `str`, replacing any occurrence of the string `pat` with the string `rep`
14091409
/// Pushes the resulting string on the stack and returns it.
1410-
pub fn gSub(lua: *Lua, str: [:0]const u8, pat: [:0]const u8, rep: [:0]const u8) [:0]const u8 {
1410+
pub fn globalSub(lua: *Lua, str: [:0]const u8, pat: [:0]const u8, rep: [:0]const u8) [:0]const u8 {
14111411
return std.mem.span(c.luaL_gsub(lua.state, str.ptr, pat.ptr, rep.ptr));
14121412
}
14131413

src/ziglua-5.2/tests.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,11 +1211,11 @@ test "checkOption" {
12111211
try expectEqualStrings("bad argument #1 to '?' (invalid option 'unknown')", try lua.toBytes(-1));
12121212
}
12131213

1214-
test "gSub" {
1214+
test "globalSub" {
12151215
var lua = try Lua.init(testing.allocator);
12161216
defer lua.deinit();
12171217

1218-
_ = lua.gSub("-gity -!", "-", "zig");
1218+
_ = lua.globalSub("-gity -!", "-", "zig");
12191219
try expectEqualStrings("ziggity zig!", try lua.toBytes(-1));
12201220
}
12211221

src/ziglua-5.3/lib.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,7 @@ pub const Lua = struct {
14631463

14641464
/// Creates a copy of string `str`, replacing any occurrence of the string `pat` with the string `rep`
14651465
/// Pushes the resulting string on the stack and returns it.
1466-
pub fn gSub(lua: *Lua, str: [:0]const u8, pat: [:0]const u8, rep: [:0]const u8) [:0]const u8 {
1466+
pub fn globalSub(lua: *Lua, str: [:0]const u8, pat: [:0]const u8, rep: [:0]const u8) [:0]const u8 {
14671467
return std.mem.span(c.luaL_gsub(lua.state, str.ptr, pat.ptr, rep.ptr));
14681468
}
14691469

src/ziglua-5.3/tests.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,11 +1240,11 @@ test "checkOption" {
12401240
try expectEqualStrings("bad argument #1 to '?' (invalid option 'unknown')", try lua.toBytes(-1));
12411241
}
12421242

1243-
test "gSub" {
1243+
test "globalSub" {
12441244
var lua = try Lua.init(testing.allocator);
12451245
defer lua.deinit();
12461246

1247-
_ = lua.gSub("-gity -!", "-", "zig");
1247+
_ = lua.globalSub("-gity -!", "-", "zig");
12481248
try expectEqualStrings("ziggity zig!", try lua.toBytes(-1));
12491249
}
12501250

src/ziglua-5.4/lib.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,7 @@ pub const Lua = struct {
15071507

15081508
/// Creates a copy of string `str`, replacing any occurrence of the string `pat` with the string `rep`
15091509
/// Pushes the resulting string on the stack and returns it.
1510-
pub fn gSub(lua: *Lua, str: [:0]const u8, pat: [:0]const u8, rep: [:0]const u8) [:0]const u8 {
1510+
pub fn globalSub(lua: *Lua, str: [:0]const u8, pat: [:0]const u8, rep: [:0]const u8) [:0]const u8 {
15111511
return std.mem.span(c.luaL_gsub(lua.state, str.ptr, pat.ptr, rep.ptr));
15121512
}
15131513

src/ziglua-5.4/tests.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,11 +1321,11 @@ test "checkOption" {
13211321
try expectEqualStrings("bad argument #1 to '?' (invalid option 'unknown')", try lua.toBytes(-1));
13221322
}
13231323

1324-
test "gSub" {
1324+
test "globalSub" {
13251325
var lua = try Lua.init(testing.allocator);
13261326
defer lua.deinit();
13271327

1328-
_ = lua.gSub("-gity -!", "-", "zig");
1328+
_ = lua.globalSub("-gity -!", "-", "zig");
13291329
try expectEqualStrings("ziggity zig!", try lua.toBytes(-1));
13301330
}
13311331

0 commit comments

Comments
 (0)