Module:ButtonBox: Difference between revisions
Appearance
fixed links |
removed unwanted players |
||
| Line 22: | Line 22: | ||
local label = row.username | local label = row.username | ||
local link = "[[" .. row.username .. "]]" | local link = "[[" .. row.username .. "]]" | ||
if row.username ~= '$1' and row.username ~= 'MHF_Steve' and row.username ~= 'BlockKnight32' then | |||
local cell = '| <div class="buttonbox-entry">'..image..'<div class="buttonbox-label">'..link..'</div> </div>' | local cell = '| <div class="buttonbox-entry">'..image..'<div class="buttonbox-label">'..link..'</div> </div>' | ||
table.insert(out, cell) | table.insert(out, cell) | ||
end | |||
end | end | ||
Revision as of 15:08, 24 June 2025
Documentation for this module may be created at Module:ButtonBox/doc
local p = {}
local cargo = mw.ext.cargo
function p.buttonbox()
local tables = 'player_data'
local fields = 'username'
local args = {
orderBy = 'username ASC',
limit = 100 -- Optional; remove or increase if needed
}
local results = cargo.query(tables, fields, args)
local out = {}
table.insert(out, '{| class="buttonbox"')
for i, row in ipairs(results) do
if (i - 1) % 4 == 0 then
table.insert(out, '|-')
end
local image = 'https://mc-heads.net/avatar/'..row.username..'/150.png'
local label = row.username
local link = "[[" .. row.username .. "]]"
if row.username ~= '$1' and row.username ~= 'MHF_Steve' and row.username ~= 'BlockKnight32' then
local cell = '| <div class="buttonbox-entry">'..image..'<div class="buttonbox-label">'..link..'</div> </div>'
table.insert(out, cell)
end
end
table.insert(out, '|}')
return table.concat(out, '\n')
end
return p