8,756
edits
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
local utilTable = require('Module:Table Utility') | local utilTable = require('Module:Table Utility') | ||
local data = require('Module:CryptogullJr/Data') | local data = require('Module:CryptogullJr/Data') | ||
local cargo = mw.ext.cargo | |||
local p = {} | local p = {} | ||
Line 70: | Line 71: | ||
else | else | ||
for i, v in ipairs(decoded["modules"][extPos]["data"]["selections"]) do | for i, v in ipairs(decoded["modules"][extPos]["data"]["selections"]) do | ||
exts[i] = v[extNoun] | if extPos == 4 then | ||
exts[1] = getCyberneticName(v[extNoun]) | |||
else | |||
exts[i] = v[extNoun] | |||
end | |||
if v["variantName"] ~= "" and v["variantName"] ~= nil then | if v["variantName"] ~= "" and v["variantName"] ~= nil then | ||
exts[i] = exts[i] .. " (" .. v["variantName"] .. ")" | exts[i] = exts[i] .. " (" .. v["variantName"] .. ")" | ||
Line 124: | Line 129: | ||
} | } | ||
} | } | ||
end | |||
function getCyberneticName(id) | |||
local result = cargo.query("Cybernetics", "CyberneticID, Name", | |||
{where='CyberneticID ="'.. id..'"'}) | |||
if not next(result) then | |||
error(id .."is not a valid cybernetic id.") | |||
else | |||
return result[1]["Name"] | |||
end | |||
end | end | ||
function p.test() | function p.test() | ||
return | return getCyberneticName("BiologicalIndexer") | ||
end | end | ||
return p | return p |