Editing Module:TNT

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
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
Cancel Editing help (opens in new window)

  [] · [[]] · [[|]] · {{}} · · “” ‘’ «» ‹› „“ ‚‘ · ~ | °   · ± × ÷ ² ³ ½ · §
     [[Category:]] · [[:File:]] · [[Special:MyLanguage/]] · Special:MyLanguage/ · <code></code> · <nowiki></nowiki> <code><nowiki></nowiki></code> · <syntaxhighlight lang="php"></syntaxhighlight> · <includeonly></includeonly> · <noinclude></noinclude> · #REDIRECT[[]] · <translate></translate> · <languages/> · {{#translation:}} · <tvar name=1></tvar> · {{DEFAULTSORT:}} · <s></s>

Template used on this page: