Hi,
I am trying to encapsulate a “service” class which makes several different http calls.
I wish to handle the return values in different listeners.
But it seems the “event” passed into the listener is always nill (the print in the handlers functions below crashes).
Can anyone please point me in the right direction?
The code:
Service = {}
function Service:new()
local service = {}
function service: performRequest1()
local url1 = “http:/someurl1”
params = {}
network.request(url1, “POST”, self.handleRequest1, params)
end
function service: performRequest2()
local url2 = “http:/someurl2”
params={}
network.request(url2, “POST”, self.handleRequest2, params)
end
function service: handleRequest1(event)
print(event.phase)
end
function service: handleRequest2(event)
print(event.phase)
end
return service
end
return FUService