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

Difference between revisions of "Module:EliteShips"

From Kancolle Wiki
Jump to navigation Jump to search
com>Ckwng
(Support for specifying cell value highlight ranges)
m (7 revisions imported)
 
(5 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
local EliteShips = {}
 
local EliteShips = {}
local EliteShipsKai = require('Module:EliteShipsKai')
+
local EliteShipsKai = false
local Ship = require('Module:Ship')
+
local EliteShipsKaiSortable = false
 
local getArgs = require('Module:GetArgs')
 
local getArgs = require('Module:GetArgs')
  
 
function EliteShips.Table(frame)
 
function EliteShips.Table(frame)
local args = getArgs{frame = frame}
+
local args = getArgs{frame = frame:getParent()}
local ships = {}
+
_prepareEliteShipsKai()
for index, ship_name in ipairs(args) do
+
return EliteShipsKai:Table(args)
local split = mw.ustring.find(ship_name, '/')
+
end
if split == nil then
+
 
ships[index] = Ship:create(ship_name)
+
function _prepareEliteShipsKai()
else
+
if not EliteShipsKai then
ships[index] = Ship:create(mw.ustring.sub(ship_name, 1, split - 1),mw.ustring.sub(ship_name, split + 1, -1))
+
EliteShipsKai = require('Module:EliteShipsKai')
end
 
 
end
 
end
local ranges = {}
+
end
for _, column in ipairs(EliteShipsKai._columns) do
+
 
local outstanding = args[column .. EliteShipsKai._outstanding_suffix]
+
function EliteShips.SortableTable(frame)
local good = args[column .. EliteShipsKai._good_suffix]
+
local args = getArgs{frame = frame:getParent()}
if outstanding and good then
+
_prepareEliteShipsKaiSortable()
local operator = args[column .. EliteShipsKai._operator_suffix] or ">"
+
return EliteShipsKaiSortable:Table(args)
ranges[column] = {}
+
end
ranges[column].operator = operator
+
 
ranges[column].outstanding = outstanding
+
function _prepareEliteShipsKaiSortable()
ranges[column].good = good
+
if not EliteShipsKaiSortable then
end
+
EliteShipsKaiSortable = require('Module:EliteShipsKaiSortable')
 
end
 
end
return EliteShipsKai:Table(ships, ranges)
 
 
end
 
end
  
 
return EliteShips
 
return EliteShips

Latest revision as of 12:26, 12 May 2021

Documentation for this module may be created at Module:EliteShips/doc

local EliteShips = {}
local EliteShipsKai = false
local EliteShipsKaiSortable = false
local getArgs = require('Module:GetArgs')

function EliteShips.Table(frame)
	local args = getArgs{frame = frame:getParent()}
	_prepareEliteShipsKai()
	return EliteShipsKai:Table(args)
end

function _prepareEliteShipsKai()
	if not EliteShipsKai then
		EliteShipsKai = require('Module:EliteShipsKai')
	end
end

function EliteShips.SortableTable(frame)
	local args = getArgs{frame = frame:getParent()}
	_prepareEliteShipsKaiSortable()
	return EliteShipsKaiSortable:Table(args)
end

function _prepareEliteShipsKaiSortable()
	if not EliteShipsKaiSortable then
		EliteShipsKaiSortable = require('Module:EliteShipsKaiSortable')
	end
end

return EliteShips