Module:VoteFuncs

local a={} function index( az, ax ) -- Find, return index for i, v in ipairs( az ) do   if ( v == ax ) then return i   end end return 0 end function tag ( x, y ) -- Make tag for i = index( votes["symbol"], x ) if i == 0 then i = index( votes["name"], x ) end xx= y and y or (" " .. votes["name"][i]) if i ~= 0 then return "" .. votes["symbol"][i] .. xx .. " "   else return "Error" end end function stag ( x, y ) -- Make source tag for if y ~= nil then return " " else return " " end end function tonum( x ) -- Conventional ToNumber return tonumber ( x ) or 0 end function a.vote( frame ) return tag(frame.args[1]) end function a.mini( frame ) return tag(frame.args[1], frame.args[2]) end function a.list( frame ) i=1 f="" while votes["name"][i] do       f=f .. "|-\n|" .. tag(votes["symbol"][i]) .. "\n|" .. stag(votes["name"][i],frame.args[1]) .. "\n" i=i+1 end return frame:preprocess("\n{| class=\"article-table\" style=\"width:100%; font-size:90%;\"\n|-\n! style=\"width:50%;\" | Template\n! style=\"width:50%;\" | Syntax (source editor)\n" .. f .. "|-\n! colspan=\"3\" | VisualEditor users: to use the voting templates, click the source mode button (the brackets) before inserting the syntax. To switch back to visual mode, click the VisualEditor button (the eye).\n|} ") end function a.cntr( frame ) local function voteCount(x,y) return (not y or frame.args[i]) and tag(voteSymbols[i],tonum(frame.args[i])) or '' end y=frame.args["padded"] return voteCount(1,y).. ' ' ..           voteCount(2,y) .. ' ' ..          voteCount(3,y) .. ' ' ..          (frame.args['X'] and            (voteCount(4,y) .. ' ' )          or '') .. (frame.args["sum"] and          tag(voteSymbols[5],tonum(frame.args[1])* 1+ tonum(frame.args[2])* 0+ tonum(frame.args[3])*-1+ tonum(frame.args[4])*-2)          or '') end return a