2,875
edits
No edit summary |
(Finally added support for ipairs) |
||
Line 33: | Line 33: | ||
end | end | ||
function Enumerator:getEnumerator() | function Enumerator:getEnumerator(isArray) | ||
error('Not implemented in base class.') | error('Not implemented in base class.') | ||
end | end | ||
Line 40: | Line 40: | ||
function Enumerator:overridePairs(startIndex) | function Enumerator:overridePairs(startIndex) | ||
-- Get or create clean enumerator. This ensures the state is 0. | -- Get or create clean enumerator. This ensures the state is 0. | ||
local enum = self:getEnumerator() | local enum = self:getEnumerator(isArray) | ||
enum.current = nil | enum.current = nil | ||
enum.index = startIndex | enum.index = startIndex | ||
local function iterator(t, k) | local function iterator(t, k) | ||
if enum:moveNext() == true then | if enum:moveNext() == true then |
edits