Modul:TemplateBox: Unterschied zwischen den Versionen
Modul:TemplateBox (Quelltext anzeigen)
Version vom 20. September 2021, 09:15 Uhr
, 09:15, 20. Sep. 2021Fullfilling my edit request: Ensure that integer keys are always visited in ascending order
Tt (Diskussion | Beiträge) K (1 Version importiert) |
StadtbahnBI>ExE Boss (Fullfilling my edit request: Ensure that integer keys are always visited in ascending order) |
||
Zeile 305: | Zeile 305: | ||
sep = sep .. sepStart | sep = sep .. sepStart | ||
local sparseIpairs = require('Module:TableTools').sparseIpairs | |||
local comapareLegacyVal = function(val) | local comapareLegacyVal = function(val) | ||
return val == 'optional-' or val == 'deprecated' | return val == 'optional-' or val == 'deprecated' | ||
Zeile 318: | Zeile 319: | ||
eachArg = function(cb) | eachArg = function(cb) | ||
for i, arg in | for i, arg in sparseIpairs( pargs ) do | ||
if ('number' == type(i)) then | if ('number' == type(i)) then | ||
argName = mw.text.trim( arg or '' ) | argName = mw.text.trim( arg or '' ) | ||
Zeile 565: | Zeile 566: | ||
end | end | ||
if processParams then | if processParams then | ||
-- Ensure that `templateArgs` contains indicies in ascending order | |||
table.sort( templateArgs ) | |||
for i, number in pairs( templateArgs ) do | for i, number in pairs( templateArgs ) do | ||
extractData( paraminfoTLParams, number ) | extractData( paraminfoTLParams, number ) |