Difference between revisions of "Module:Changes"
Jump to navigation
Jump to search
m (Hmmmm) |
m (Gah, I have other things that need to be done. I'll fix this later) |
||
| Line 12: | Line 12: | ||
--repeat s = args["change" .. n] | --repeat s = args["change" .. n] | ||
if args["loop"] == nil then | --if args["loop"] == nil then | ||
-- local loop = 0 | |||
else | --else | ||
-- local loop = tonumber(args["loop"]) | |||
end | --end | ||
for i = 1,loop,1 do | --for i = 1,loop,1 do | ||
s = args["change" .. i] | s = args["change" .. i] | ||
groups[i] = "<li>" .. s .. "</li>" | groups[i] = "<li>" .. s .. "</li>" | ||
--groups[n] = "<li>" .. args["change" .. n] .. "</li>" | --groups[n] = "<li>" .. args["change" .. n] .. "</li>" | ||
--until s == nil | --until s == nil | ||
end | --end | ||
local back = "Arguments <br/>" | local back = "Arguments <br/>" | ||
Revision as of 19:13, 9 February 2015
Replacement Lua scripting to do what Template:Changes does/did, but in a more flexible way.
- It supports the new structure of Version History.
- It can have as many changes as needed, providing that they go up sequencially, and numbers are not missed out (change1, change2, change3 is ok, but change1, change3 isn't).
- It should be faster.
Message me (Chocohead) either on the wiki (here) or on the Forum if you find any problems.
The above documentation is transcluded from Module:Changes/doc. (edit | history)
local p = {}
-- Changes
function p.changes( f )
local args = f
local groups = {}
local s = nil
if f == mw.getCurrentFrame() then
args = f:getParent().args
end
--repeat s = args["change" .. n]
--if args["loop"] == nil then
-- local loop = 0
--else
-- local loop = tonumber(args["loop"])
--end
--for i = 1,loop,1 do
s = args["change" .. i]
groups[i] = "<li>" .. s .. "</li>"
--groups[n] = "<li>" .. args["change" .. n] .. "</li>"
--until s == nil
--end
local back = "Arguments <br/>"
for key,value in pairs(groups) do
back = back .. value .. "<br/>"
end
return back
end
return p