×
Create a new article
Write your page title here:
We currently have 230 articles on Farthest Frontier. Type your article name above or create one of the articles listed here!



    Farthest Frontier

    Module:TNT: Difference between revisions

    Content added Content deleted
    m (1 revision imported)
    (updating to current TNT standard)
    Line 50: Line 50:
    id = mw.text.trim(v)
    id = mw.text.trim(v)
    elseif type(k) == 'number' then
    elseif type(k) == 'number' then
    params[k - 2] = mw.text.trim(v)
    table.insert(params, mw.text.trim(v))
    elseif k == 'lang' and v ~= '_' then
    elseif k == 'lang' and v ~= '_' then
    lang = mw.text.trim(v)
    lang = mw.text.trim(v)
    Line 96: Line 96:
    local data = loadData(dataset)
    local data = loadData(dataset)
    local names = {}
    local names = {}
    for _, field in ipairs(data.schema.fields) do
    for _, field in pairs(data.schema.fields) do
    table.insert(names, field.name)
    table.insert(names, field.name)
    end
    end
    Line 102: Line 102:
    local params = {}
    local params = {}
    local paramOrder = {}
    local paramOrder = {}
    for _, row in ipairs(data.data) do
    for _, row in pairs(data.data) do
    local newVal = {}
    local newVal = {}
    local name = nil
    local name = nil
    for pos, columnName in ipairs(names) do
    for pos, val in pairs(row) do
    local columnName = names[pos]
    if columnName == 'name' then
    if columnName == 'name' then
    name = row[pos]
    name = val
    else
    else
    newVal[columnName] = row[pos]
    newVal[columnName] = val
    end
    end
    end
    end
    Line 156: Line 157:
    -- Give helpful error to thirdparties who try and copy this module.
    -- Give helpful error to thirdparties who try and copy this module.
    if not mw.ext or not mw.ext.data or not mw.ext.data.get then
    if not mw.ext or not mw.ext.data or not mw.ext.data.get then
    error(string.format([['''Missing JsonConfig extension, or not properly configured;
    error('Missing JsonConfig extension; Cannot load https://commons.wikimedia.org/wiki/Data:' .. dataset)
    Cannot load https://commons.wikimedia.org/wiki/Data:%s.
    See https://www.mediawiki.org/wiki/Extension:JsonConfig#Supporting_Wikimedia_templates''']], dataset))
    end
    end


    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.