Advertisement
xerpi

[LUA] Get bookmarks PSP funcion

Jul 16th, 2011
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. -----------------xerpi (c) 2011 -------------------------
  2.  
  3. function get_bookmarks()
  4. local tab = {}
  5. local posi = 0
  6. local posf =0
  7. local pos2i = 0
  8. local pos2f =0
  9. local url = ""
  10. local name = ""
  11. local i =0
  12.     if files.exists("ms0:/PSP/SYSTEM/BROWSER/bookmarks.html") then
  13.             for linea in io.lines("ms0:/PSP/SYSTEM/BROWSER/bookmarks.html") do
  14.                 i = i+1
  15.                 a,b = string.find(linea,'HREF="')
  16.                 if a and b then
  17.                     posi=b+1
  18.                     c,d = string.find(linea,'"',posi+1)
  19.                     if c and d then
  20.                         posf =d-1
  21.                         url = string.sub(linea,posi,posf)
  22.                         e,f = string.find(linea,'>',posf+1)
  23.                             if e and f then
  24.                                 pos2i = f+1
  25.                                 g,h = string.find(linea,'</A>',pos2i)
  26.                                     if g and h then
  27.                                         pos2f = g-1
  28.                                         name = string.sub(linea,pos2i,pos2f)                                   
  29.                                     end
  30.                             end
  31.                            
  32.                            
  33.                         table.insert(tab,{url=url,name=name})
  34.                     end        
  35.                 end                
  36.             end
  37.         return tab
  38.     end
  39. return false
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement