Anonymous

Module:FunList/Iterators: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
No edit summary
Line 16: Line 16:


function Enumerator:moveNext()
function Enumerator:moveNext()
mw.log('calling broken func')
error('Not implemented in base class.')
error('Not implemented in base class.')
end
end
Line 46: Line 47:


function TableEnumerator:moveNext()
function TableEnumerator:moveNext()
mw.log('calling override with')
mw.log('key: ' .. self.index)
mw.log('val: ' .. self.current)
-- Grab the next index for the internal table.
-- Grab the next index for the internal table.
local key = self.index
local key = self.index
Line 52: Line 56:
-- If the index exist, we have succesfuly moved to the next.
-- If the index exist, we have succesfuly moved to the next.
if key then
if key ~= nil then
self.current = self.data[key]
self.current = self.data[key]
return true
end
return false
end
function TableEnumerator:moveINext()
self.index = self.index + 1
self.current = self.data[self.index]
if self.current ~= nil then
return true
return true
end
end
2,875

edits