Modulo:Quorum: differenze tra le versioni
Contenuto cancellato Contenuto aggiunto
aggiungo funzione |
correggo |
||
(2 versioni intermedie di uno stesso utente non sono mostrate) | |||
Riga 21:
local quorum = 0
local elections, candidates, votes = {}, {}, {}
for election in string.gmatch(source or '', pattern) do
if not source or #candidates == 8 then
return set_error('bad_list', page)
Line 35 ⟶ 36:
local candidate = election:match('Elezioni/([^/]+)')
table.insert(candidates, string.format('[[User:%s|%s]]', candidate, candidate))
votes[#candidates] = 0
for heading, section in string.gmatch(content, '\n==+ *([^\n]-) *==+(.-)\r') do
if heading == 'Pro' or heading == 'Contro' then
local _, count = section:gsub('\n#[^#:*\n][^\n]-%a', '')
quorum = quorum + count
votes[#candidates] =
end
end
|