Module:Redirect hatnote: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
increment iArg two at a time; better but still buggy
(still wrong, but slightly less wrong?)
(increment iArg two at a time; better but still buggy)
Line 13:
function p.redirect(frame)
-- Get the args table and work out the maximum arg key.
 
--[[
local origArgs = frame:getParent().args
local args = {}
Line 23 ⟶ 25:
if v ~= '' then
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
Line 38 ⟶ 49:
-- Create the data table.
local data = {}
local iArg = 10
local iData = 1
while iArg < maxArg do
iArg = iArg + 12
local useTable = data[iData] or {}
local use, page,= isLastUseargs[iArg]
iflocal iArgpage %= 2 ==args[iArg 0+ then1]
useTable[#useTable + 1] = page
use = args[iArg]
if use ~= 'and' then
useTable.use = use
isLastUse = true
end
else
page = args[iArg]
useTable[#useTable + 1] = page
end
data[iData] = useTable
if isLastUseuse ~= 'and' then
useTable.use = use
iData = iData + 1
end
mw.logObject(useTable)
end
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu