Editing
Module:Update history
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} local mw = require('mw') local function findBlockEnd(content, start_pos) local open_braces = 0 local current_pos = start_pos while current_pos <= #content do local char = content:sub(current_pos, current_pos) if char == "{" then open_braces = open_braces + 1 elseif char == "}" then open_braces = open_braces - 1 if open_braces == 0 then return current_pos end end current_pos = current_pos + 1 end return nil end function p.getRecentUpdates(frame) local title = mw.title.getCurrentTitle() local pageName = title.baseText local lang = frame.args[1] or '' local pageTitle if lang ~= '' then pageTitle = pageName .. '/Update history/' .. lang else pageTitle = pageName .. '/Update history' end local historyPage = mw.title.new(pageTitle) local pageContent = historyPage and historyPage:getContent() or "" local block_start = pageContent:find('{{Update history table/row') if not block_start then return "" end local blocks = {} local block_end local max_blocks = 3 local block_count = 0 while block_start and block_count < max_blocks do block_end = findBlockEnd(pageContent, block_start) if not block_end then break end local block_content = pageContent:sub(block_start, block_end) table.insert(blocks, block_content) block_count = block_count + 1 if block_count < max_blocks then block_start = pageContent:find('{{Update history table/row', block_end + 1) else block_start = nil end end local processedBlocks = {} for _, block in ipairs(blocks) do local parsedBlock = frame:preprocess(block) table.insert(processedBlocks, parsedBlock) end local processedContent = table.concat(processedBlocks, '\n') return processedContent end return p
Summary:
Please note that all contributions to Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
Deadlock:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Template used on this page:
Module:Update history/doc
(
edit
)
Navigation menu
Personal tools
English
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Module
Discussion
English
Views
Read
Edit source
View history
More
Search
Navigation
Main page
Discord community
Recent changes
Random page
Tools
What links here
Related changes
Special pages
Page information
Languages