Zum Inhalt springen

Modul:Redirect hatnote: Unterschied zwischen den Versionen

use a repeat ... until loop to avoid creating an unnecessary blank table
(Ok, I think this got it)
(use a repeat ... until loop to avoid creating an unnecessary blank table)
Zeile 14: Zeile 14:
-- Get the args table and work out the maximum arg key.
-- Get the args table and work out the maximum arg key.


--[[
local origArgs = frame:getParent().args
local origArgs = frame:getParent().args
local args = {}
local args = {}
Zeile 25: Zeile 24:
if v ~= '' then
if v ~= '' then
args[k] = v
args[k] = v
end
end
--]]
local args = require('Module:Arguments').getArgs(frame)
local maxArg = 0
for k, v in pairs(args) do
if type(k) == 'number' and k > maxArg then
maxArg = k
end
end
end
end
Zeile 51: Zeile 41:
local iArg = 0
local iArg = 0
local iData = 1
local iData = 1
while iArg < maxArg do
repeat
iArg = iArg + 2
iArg = iArg + 2
local useTable = data[iData] or {}
local useTable = data[iData] or {}
Zeile 65: Zeile 55:
iData = iData + 1
iData = iData + 1
end
end
mw.logObject(useTable)
until iArg >= maxArg - 1
end


-- Create the options table.
-- Create the options table.