Lua: Expose Go slices as read-only

This commit is contained in:
Meo597
2026-11-20 05:16:13 +08:00
parent 02cf0f60ea
commit 84ce7568bb
5 changed files with 30 additions and 52 deletions
+3 -1
View File
@@ -104,7 +104,9 @@ for _, value in ipairs({matcher, domain}) do
assert(not pcall(function() return value ^ {} end))
end
assert(domain:matchAny("example.com"))
assert(#domain:Match("example.com") == 1)
local indices = domain:Match("example.com")
assert(#indices == 1)
assert(not pcall(function() indices[1] = 7 end))
assert(domain:match("example.com")[1] == 0)
assert(not pcall(function() matcher:AnyMatch() end))
assert(not pcall(function() matcher:AnyMatch(matched, true) end))