RSS

Hello! I looked around at how to read RSS feeds and I found the code below. The program prints out to the Corona terminal great, but how do I get the data into a text field on the app? Parsing?

I looked at this page: http://lua-users.org/wiki/LuaXml, but it's a little over my head.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
-- load needed modules
local http = require("socket.http")
local ltn12 = require("ltn12")
 
-- a simplified http.get function
local function httpget(u)
  local t = {}
  local r = http.request{
                url = u,
                sink = ltn12.sink.table(t)
                }
  return t
end
 
local function dump(o)
        if type(o) == 'table' then
                local s = '{ '
                for k,v in pairs(o) do
                        if type(k) ~= 'number' then k = '"'..k..'"' end
                        s = s .. '['..k..'] = ' .. dump(v) .. ','                                               
                                                local tempDisplay = display.newText(k, 0,xSize, Ghoulish, 62);
                                                xSize = xSize + 100
                end
                return s .. '} '
        else
                return tostring(o)
        end
end
 
 
local x = httpget("http://feeds.feedburner.com/AnscaMobileBlog")
 
print(dump(x))
temp = dump(x);

did you figure this out?

views:1542 update:2011/9/28 9:01:40
corona forums © 2003-2011