2,875
edits
No edit summary |
No edit summary |
||
Line 22: | Line 22: | ||
-- Hooks the moveNext function into the Lua 'pairs' function | -- Hooks the moveNext function into the Lua 'pairs' function | ||
function Enumerator:overridePairs() | function Enumerator:overridePairs() | ||
mw.log('overriding pairs()') | |||
self.index = nil | |||
self.current = nil | |||
local function iterator(t, k) | local function iterator(t, k) | ||
if self:moveNext() == true then | if self:moveNext() == true then | ||
Line 29: | Line 32: | ||
end | end | ||
return iterator, self, nil | return iterator, self, nil | ||
end | end | ||
Line 48: | Line 49: | ||
function TableEnumerator:moveNext() | function TableEnumerator:moveNext() | ||
mw.log('calling override with') | mw.log('calling override with') | ||
mw.log('key: ' .. self.index) | mw.log('key: ' .. tostring(self.index)) | ||
mw.log('val: ' .. self.current) | mw.log('val: ' .. tostring(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 |
edits