Module:Skill: Difference between revisions
From Portals of Phereon Wiki
Content added Content deleted
(Creating/Testing for first time) |
No edit summary |
||
Line 6: | Line 6: | ||
local temp_res = {}; |
local temp_res = {}; |
||
local fstr = utils.toNumberedTable(frame.args[2]); |
local fstr = utils.toNumberedTable(frame.args[2]); |
||
local results = cargo.query(frame.args[1], utils.trimBrackets(frame.args[3] |
local results = cargo.query(frame.args[1], utils.trimBrackets(frame.args[3])); |
||
for _, result in ipairs(results) do |
for _, result in ipairs(results) do |
||
local temp_item = {'|-\n'}; |
local temp_item = {'|-\n'}; |
Revision as of 20:22, 9 April 2022
Documentation for this module may be created at Module:Skill/doc
local p = {};
local cargo = mw.ext.cargo;
local utils = require( "Module:Utils" );
function p.skills(frame)
local temp_res = {};
local fstr = utils.toNumberedTable(frame.args[2]);
local results = cargo.query(frame.args[1], utils.trimBrackets(frame.args[3]));
for _, result in ipairs(results) do
local temp_item = {'|-\n'};
for r, fv in ipairs( fstr ) do
local v = result["'" .. tostring(r) .. "'"];
temp_item[#temp_item+1] = '|';
if (v ~= nil) then
if fv == 'SkillName' then
temp_item[#temp_item+1] = ' id="' .. v .. '" |' .. v;
else
temp_item[#temp_item+1] = v;
end
end
temp_item[#temp_item+1] = '\n';
end
temp_res[#temp_res+1] = table.concat(temp_item,"");
end
local restbl = table.concat(temp_res,"");
return restbl;
end
return p