Advertisement
guitarplayer616

XMLua

Jun 23rd, 2015
360
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. local tArgs = { ... }
  2. local h = fs.open(tArgs[1],"r")
  3. local html = h.readAll()
  4. h.close()
  5. local k = fs.open("txt","w")
  6. local j = fs.open("txt2","w")
  7. local quotes = {}
  8. local sources = {}
  9.  
  10.  
  11. html:gsub("<quote>(.-)</quote>",function(a) table.insert(quotes,a) end)
  12. html:gsub("<source>(.-)</source>",function(a) table.insert(sources,a) end)
  13.  
  14. shell.run("clr")
  15. for i,v in ipairs(quotes) do
  16.   print(i,": ",v)
  17.   k.writeLine(v)
  18.   k.flush()
  19. end
  20.  
  21. for i,v in ipairs(sources) do
  22.   j.write('<')
  23.   j.write(v)
  24.   j.write(">\"")
  25.   for i2,v2 in ipairs(quotes) do
  26.     if i == i2 then
  27.       j.write(v2)
  28.     end
  29.   end
  30.   j.writeLine("\"")
  31.   j.flush()
  32. end
  33.  
  34. k.close()
  35. j.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement