Mercurial > hg > Members > nobuyasu > Lua
changeset 7:ec8638157982
modified
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 28 Sep 2013 07:30:17 +0900 |
parents | 18ba4378501e |
children | b5ce185f154b |
files | http/win_rate.lua |
diffstat | 1 files changed, 18 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/http/win_rate.lua Sat Sep 28 07:19:13 2013 +0900 +++ b/http/win_rate.lua Sat Sep 28 07:30:17 2013 +0900 @@ -17,9 +17,11 @@ local xmlString = table.concat(request) local match = xmlString:gmatch('<table>(.-)</table>') local count = 0 -local userInfo = {} +local userInfoTable = {} for i in match do local names = i:gmatch('<td style="color: #FFF;">(.-)</td>') + userInfoTable[count] = {} + local userInfo = userInfoTable[count] for j in names do local href, name = j:match('<a href="(.-)">(.-)</a>') if (href == nil) then @@ -51,14 +53,22 @@ return winNum end -for i,v in pairs(userInfo) do - local userName = i - local userTable = v - local userUrl = v["href"] - userTable['win'] = getWinNum(baseUrl..userUrl) +for j,l in pairs(userInfoTable) do + local userInfo = userInfoTable[j] + for i,v in pairs(userInfo) do + local userName = i + local userTable = v + local userUrl = v["href"] + userTable['win'] = getWinNum(baseUrl..userUrl) + end end -for i,v in pairs(userInfo) do - print(i.." "..v['win']) +for j,l in pairs(userInfoTable) do + for i,v in pairs(l) do + print(i.." "..v['win']) + end + print("") end + +