Module:ButtonBox: Difference between revisions
Appearance
Prevent duplicate pages |
Tag: Undo |
| (One intermediate revision by the same user not shown) | |
(No difference)
| |
Latest revision as of 21:19, 11 November 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,
groupBy = 'username'
}
local results = cargo.query(tables, fields, args)
local out = { '{| class="buttonbox"' }
local count = 1
for _, row in ipairs(results) do
local user = row.username
if user ~= '$1'
and user ~= 'MHF_Steve'
and user ~= 'BlockKnight32'
then
if (count - 1) % 7 == 0 then
table.insert(out, '|-')
end
local image = 'https://mc-heads.net/avatar/' .. user .. '/100.png'
local link = '[[' .. user .. ']]'
local cell = '| <div class="buttonbox-entry">' ..
image ..
'<div class="buttonbox-label">' .. link .. '</div>' ..
' </div>'
table.insert(out, cell)
count = count + 1
end
end
table.insert(out, '|}')
return table.concat(out, '\n')
end
return p