All pastes #909122 Raw Edit

Someone

public lua v1 · immutable
·published 2008-02-18 22:49 UTC
rendered paste body
#!/usr/bin/lua--Saigar results findererfunction explode(div,str)	if (div=='') then return false end	local pos,arr = 0,{}	-- for each divider found	for st,sp in function() return string.find(str,div,pos,true) end do		table.insert(arr,string.sub(str,pos,st-1)) -- Attach chars left of current divider		pos = sp + 1 -- Jump past current divider	end	table.insert(arr,string.sub(str,pos)) -- Attach chars right of last divider	return arrendfunction getFunkNum(res)	local n = explode("\n",res)	local r = {}	for _,v in pairs(n) do		local z = explode(",",v)		local na = z[#z]		if not r[na] then			r[na] = 1		else			r[na]=r[na]+1		end	end	return rendif arg[1] then	print("Loading "..arg[1])	local f = io.open(arg[1],"r")	local s = f:read("*all")	f:close()	local r = getFunkNum(s)	for k,v in pairs(r) do		print("Votes for "..k..": "..v)	endend