• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
support generic iterators
Line 1: Line 1:  
local BaseData = require('Module:BaseData')
 
local BaseData = require('Module:BaseData')
 
+
local Iterator = require('Module:Iterator')
 
local format = require('Module:StringInterpolation').format
 
local format = require('Module:StringInterpolation').format
   Line 295: Line 295:  
function BaseTable:join_rows()
 
function BaseTable:join_rows()
 
self._result = table.concat(self._rows, "\n")
 
self._result = table.concat(self._rows, "\n")
 +
end
 +
 +
function BaseTable:prepare_iterator()
 +
    local buildIterator = Iterator[self._args.iterator]
 +
    if buildIterator then
 +
        local iterator = buildIterator(self._args)
 +
        while iterator.next() do
 +
            table.insert(self._args, iterator.current())
 +
        end
 +
    end
 
end
 
end
   Line 313: Line 323:  
self._notes = {}
 
self._notes = {}
 
self._data_rows = {}
 
self._data_rows = {}
 +
self:prepare_iterator()
 
self:create_table_prep()
 
self:create_table_prep()
  
cssedit, gkautomate
6,928

edits

Navigation menu