Module:TNT: Difference between revisions
Jump to navigation
Jump to search
m 10 revisions imported from metawikimedia:Module:TNT: Required for local usage |
m Restoring to this earlier revision in the attempt to resolve a missing Lua I18n component error with the Template:User template. I will revert if this does not work |
||
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 | 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 | 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 | for _, row in pairs(data.data) do | ||
local newVal = {} | local newVal = {} | ||
local name = nil | local name = nil | ||
for pos, | for pos, val in pairs(row) do | ||
local columnName = names[pos] | |||
if columnName == 'name' then | if columnName == 'name' then | ||
name = | name = val | ||
else | else | ||
newVal[columnName] = | newVal[columnName] = val | ||
end | end | ||
end | end |