Modul:TNT: Unterschied zwischen den Versionen

Zur Navigation springen Zur Suche springen
17 Bytes hinzugefügt ,  23:02, 10. Sep. 2021
K
1 Version importiert
StadtbahnBI>Yurik
(Apply fix from user:ExE Boss - copying https://www.mediawiki.org/w/index.php?title=Module:TNT/sandbox&oldid=4692817)
K (1 Version importiert)
Zeile 50: Zeile 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)
Zeile 96: Zeile 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
Zeile 102: Zeile 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

Navigationsmenü