Anonymous

Module:FunList/Iterators: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
No edit summary
Line 62: Line 62:
     local self = setmetatable(Enumerator.new(), TableEnumerator)
     local self = setmetatable(Enumerator.new(), TableEnumerator)
     self.tbl = tbl
     self.tbl = tbl
    mw.log('creating table enum')
     return self
     return self
end
end


function TableEnumerator:moveNext()
function TableEnumerator:moveNext()
mw.log('moving next')
if true then return false end
if self.state == 0 then
if self.state == 0 then
self.state = 1
self.state = 1
Line 88: Line 85:


function TableEnumerator:getEnumerator()
function TableEnumerator:getEnumerator()
mw.log('getting enum')
if self.state == 0 then
if self.state == 0 then
mw.log('getting self')
return self
return self
else
else
mw.log('creating new enum with:  ' .. tostring(self.tbl))
return TableEnumerator.new(self.tbl)
return TableEnumerator.new(self.tbl)
end
end
2,875

edits