To create new wiki account, please join us on #znc at freenode and ask admins to create a wiki account for you. You can say thanks to spambots for this inconvenience.

Difference between revisions of "Module:ChangeLog"

From ZNC
Jump to: navigation, search
Line 1: Line 1:
 
local p = {}
 
local p = {}
 +
 
function p.prev(frame)
 
function p.prev(frame)
 
   local versions = mw.text.split(frame:expandTemplate{title='ZNC-Versions'}, '%s')
 
   local versions = mw.text.split(frame:expandTemplate{title='ZNC-Versions'}, '%s')
   local prev = nil
+
   local found = nil
 
   for i = 1, #versions, 1 do
 
   for i = 1, #versions, 1 do
 
     if versions[i] == frame.args.this then
 
     if versions[i] == frame.args.this then
       prev = i - 1
+
       found = i - 1
 
       break
 
       break
 
     end
 
     end
 
   end
 
   end
   return tostring(versions[prev])
+
   return mw.ustring.gsub(frame.args.template, 'XXX', versions[found])
 
end
 
end
 +
 
function p.next(frame)
 
function p.next(frame)
   return 'Hello'
+
  local versions = mw.text.split(frame:expandTemplate{title='ZNC-Versions'}, '%s')
 +
  local found = nil
 +
  for i = 1, #versions, 1 do
 +
    if versions[i] == frame.args.this then
 +
      found = i + 1
 +
      break
 +
    end
 +
  end
 +
   return mw.ustring.gsub(frame.args.template, 'XXX', versions[found])
 
end
 
end
 +
 
function p.stability(frame)
 
function p.stability(frame)
 
   return 'stable'
 
   return 'stable'
 
end
 
end
 +
 
return p
 
return p

Revision as of 09:10, 2 April 2017

Documentation for this module may be created at Module:ChangeLog/doc

local p = {}

function p.prev(frame)
  local versions = mw.text.split(frame:expandTemplate{title='ZNC-Versions'}, '%s')
  local found = nil
  for i = 1, #versions, 1 do
    if versions[i] == frame.args.this then
      found = i - 1
      break
    end
  end
  return mw.ustring.gsub(frame.args.template, 'XXX', versions[found])
end

function p.next(frame)
  local versions = mw.text.split(frame:expandTemplate{title='ZNC-Versions'}, '%s')
  local found = nil
  for i = 1, #versions, 1 do
    if versions[i] == frame.args.this then
      found = i + 1
      break
    end
  end
  return mw.ustring.gsub(frame.args.template, 'XXX', versions[found])
end

function p.stability(frame)
  return 'stable'
end

return p