打开/关闭搜索
搜索
打开/关闭菜单
通知
打开/关闭个人菜单
查看“模块:Infobox/item/multidata”的源代码
来自Cookie☆Wiki
查看
阅读
查看源代码
查看历史
associated-pages
模块
讨论
更多操作
←
模块:Infobox/item/multidata
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} function p.make() local parent = frame:getParent() local itemsPerRow = tonumber(parent.args['row-items']) if true then return itemsPerRow end if itemsPerRow == nil then error('"row-items" is not a number') end local count = 0 local unnamed = {} for k, v in pairs(parent.args) do if tonumber(k) ~= nil then table.insert(unnamed, v) count = count + 1 end end local result = '' local widthPercent = string.format('%.2f', 100/itemsPerRow) .. '%' local majorPart = math.floor(count / itemsPerRow) * itemsPerRow local i = 1 while (true) do if i > majorPart then break end result = result .. frame:expandTemplate{ title = 'Infobox/item/data', args = { width = widthPercent, data = unnamed[i] } } i = i + 1 end local remain = count - majorPart if remain ~= 0 then widthPercent = string.format('%.2f', 100/(remain)) .. '%' while (true) do if i > count then break end result = result .. frame:expandTemplate{ title = 'Infobox/item/data', args = { width = widthPercent, data = unnamed[i] } } i = i + 1 end end return result end return p
本页使用的模板:
模块:Infobox/item/multidata/doc
(
查看源代码
)
返回
模块:Infobox/item/multidata
。