Skip to content
This repository has been archived by the owner on Oct 28, 2022. It is now read-only.

Add __len metamethod proxying #23

Merged
merged 2 commits into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/Sandbox/Sandbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ function Sandbox.new(options)
end
-- TODO -- self:ActivityEvent("DoneIterating", real)
end)), self:Import(real)
end,
__len = function(object)
self:ProcessTermination()
self:TrackThread()

local real = self:GetClean(object)
return #real
end
-- __metatable = "The metatable is locked."
},
Expand Down Expand Up @@ -201,6 +208,13 @@ function Sandbox.new(options)
end
-- TODO -- self:ActivityEvent("DoneIterating", real)
end), real
end,
__len = function(object)
self:ProcessTermination()
self:TrackThread()

local real = self:GetClean(object)
return #real
end
-- __metatable = "The metatable is locked."
}
Expand Down
6 changes: 6 additions & 0 deletions src/Tests/H6x/Detection/TableLen.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
return function(H6x)
local sandbox = H6x.Sandbox.new()
assert(sandbox:ExecuteFunction(function(tab)
return #tab
end, {1, 2, 3}) == 3, "Table length does not match.")
end
2 changes: 1 addition & 1 deletion wally.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "hexcede/h6x"
description = "A luau utility for constructing sandboxes to run code within."
version = "2.1.2"
version = "2.1.3"
license = "MIT"
authors = ["Hexcede"]
registry = "https://github.com/UpliftGames/wally-index"
Expand Down