Open main menu
Home
Random
Nearby
Log in
Settings
About Kancolle Wiki
Disclaimers
Kancolle Wiki
Search
Changes
← Older edit
Newer edit →
Module:BaseTable
(view source)
Revision as of 19:18, 6 October 2017
354 bytes added
,
7 years ago
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
7,064
edits