I have a function which I call to obtain HTTP data for my app.
First it checks if a connection is available:
[lua]local function getHTTP( URL, Host )
if require(“socket”).connect(Host, 80) ~= nil then[/lua]
Next it makes the HTTP call:
[lua]local content,c,h = http.request( URL )[/lua]
Then it returns the result for processing by the caller:
[lua]return content[/lua]
It runs flawlessly the FIRST time. But if I call the getHTTP function a second time I get the following debug error for the http.request:
attempt to call field ‘request’ (a nil value)
stack traceback:
[C]: in function ‘request’
I’m not sure how to get past this since http.request works perfectly the first time the function is called but not the second.
[import]uid: 11393 topic_id: 4150 reply_id: 304150[/import]