Module:Article history: Difference between revisions

Content deleted Content added
add code to initialise action objects
move the action parameter values to the config
Line 38:
function Action.new(data)
-- Valid data table keys:
-- code, result, link, paramNum, rowCfg, titlearticleHistoryObj
local obj = setmetatable({}, Action)
return obj
Line 111:
-- Filter the arguments for actions.
local actionParams = {}
local pattern = '^' .. obj.cfg.actionParamPrefix .. '([1-9][0-9]*)(.-)$'
local suffixes = {obj.cfg.actionParamSuffixes
[''] = 'id',
date = 'date',
link = 'link',
result = 'result',
oldid = 'oldid'
}
for k, v in pairs(args) do
if type(k) == 'string' then
local num, suffix = key:match('^action([1-9][0-9]*)(.-)$'pattern)
if num and suffix and suffixes[suffix] then
num = tonumber(num)