Posted 27 May 2013 - 10:40 PM
Alright, say I have a list on a module on a Enjin forum website of the max player time on the server. How might I be able to get rid of everything else except the player name, and the top 5 times?
local html = (http.get("http://tekkitbyfifty.com/")).readAll();
local i = string.find(html.."", "minecraftservertopplayersonline", 1, true);
html = string.sub(html, i).."";
i = string.find(html, "</td>", 1, true);
html = string.sub(html, 1, i).."";
local ret = {};
local time = "";
local player = "";
i = string.find(html, "time", 1, true);
while i ~= nil do
html = string.sub(html, i).."";
i = string.find(html, ">", 1, true);
html = string.sub(html, i+1).."";
i = string.find(html, "<", 1, true);
time = string.sub(html, 1, i).."";
i = string.find(html, "name", 1, true);
html = string.sub(html, i).."";
i = string.find(html, ">", 1, true);
html = string.sub(html, i+1).."";
i = string.find(html, "<", 1, true);
player = string.sub(html, 1, i).."";
ret[#ret+1] = {player=player; time=time;};
print(player..": "..time);
i = string.find(html, "time", 1, true);
end