• 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
no edit summary
Line 19: Line 19:  
end
 
end
   −
function Iterator.equipmentById(context)
+
function Iterator.equipmentById(context, n)
     local from = context and context.from and tonumber(context.from) or 1
+
    local fromKey = "from" .. (n and tostring(n) or "")
     local to = context and context.to and tonumber(context.to) or 500
+
    local toKey = "to" .. (n and tostring(n) or "")
 +
     local from = context and context[fromKey] and tonumber(context[fromKey]) or 1
 +
     local to = context and context[toKey] and tonumber(context[toKey]) or 500
 
     local collection = require('Module:Collection/Equipment')
 
     local collection = require('Module:Collection/Equipment')
 
     local i = 1
 
     local i = 1
Line 44: Line 46:  
end
 
end
   −
function Iterator.equipment()
+
function Iterator.equipment(n)
     return Iterator.equipmentById()
+
     return Iterator.equipmentById(nil, n)
 
end
 
end
   −
function Iterator.equipmentByType(context)
+
function Iterator.equipmentByType(context, n)
     local type = context and context.type and tonumber(context.type)
+
    local typeKey = "type" .. (n and tostring(n) or "")
 +
     local type = context and context[typeKey] and tonumber(context[typeKey])
 
     local collection = require('Module:Collection/Equipment')
 
     local collection = require('Module:Collection/Equipment')
 
     local i = 1
 
     local i = 1
Line 57: Line 60:  
             for _ = i, #collection do
 
             for _ = i, #collection do
 
                 if collection[i].type == type then
 
                 if collection[i].type == type then
 +
                    current = collection[i].name
 +
                    i = i + 1
 +
                    return true
 +
                end
 +
                i = i + 1
 +
            end
 +
            current = nil
 +
            return false
 +
        end,
 +
        current = function()
 +
            return current
 +
        end,
 +
    }
 +
end
 +
 +
function Iterator.equipmentByTypeAndIcon(context, n)
 +
    local typeKey = "type" .. (n and tostring(n) or "")
 +
    local iconKey = "icon" .. (n and tostring(n) or "")
 +
    local type = context and context[typeKey] and tonumber(context[typeKey])
 +
    local icon = context and context[iconKey] and tonumber(context[iconKey])
 +
    local collection = require('Module:Collection/Equipment')
 +
    local i = 1
 +
    local current
 +
    return {
 +
        next = function()
 +
            for _ = i, #collection do
 +
                if collection[i].type == type and collection[i].icon == icon then
 
                     current = collection[i].name
 
                     current = collection[i].name
 
                     i = i + 1
 
                     i = i + 1
cssedit, gkautomate
7,060

edits

Navigation menu