Shaleych (обсуждение | вклад) мНет описания правки |
Shaleych (обсуждение | вклад) мНет описания правки |
||
Строка 18: | Строка 18: | ||
local result = cargo.query( tables, fields, args ) |
local result = cargo.query( tables, fields, args ) |
||
+ | local r = result[1] |
||
− | |||
local text = {} |
local text = {} |
||
Версия от 16:39, 27 июля 2020
Для документации этого модуля может быть создана страница Модуль:Belt Artifacts Project/doc
local itemIcon = require('Модуль:Item_icon')
local p = {}
function p.Main( frame )
local cargo = mw.ext.cargo
tables = 'Items'
fields = '_pageName,name,quality,icon,stat_universal,level'
local args = {
where='type HOLDS LIKE "%' .. frame.args['тип'] .. '%"',
groupBy = '_pageName',
orderBy = '_pageName',
}
if frame.args['уровень'] ~= '' then
args.where = args.where .. ' AND level = "' .. frame.args['уровень'] .. '"'
end
local result = cargo.query( tables, fields, args )
local r = result[1]
local text = {}
for i,v in ipairs(result) do
text[i] = frame:expandTemplate{title = '*'} .. ' ' .. '<span style="display:inline-block;overflow:hidden;width:20px;height:20px;vertical-align:middle;margin-left:-1pt;">[[Файл:' .. r['icon'] .. '|20px|bottom|ссылка=' .. r['_pageName'] .. ']]</span> ' .. '[[<span class="ajaxttlink">'.. r['_pageName'] ..'</span>]]'
end
return table.concat(text)
end
return p