next() works directly with the table, ignoring __iter. Custom iteration works in for loops via __iter, but next() won’t use it. Example:
local Copy = {a = 1, b = 2, c = 3}
local MetaTable = {
__iter = function(t)
return next, t, nil
end
}
setmetatable(Copy, MetaTable)
for k, v in Copy do -- Uses __iter
print(k, v)
end
print(next(Copy)) -- Ignores __iter
So I suppose I should just make a custom function like :GetOriginalTable() that well, returns the original table so I can use the next() function thanks.