Getting Error With Network.request

Here is my code. for the life of me I dont understand why I am getting a run time error that said “attempting to call field ‘request’  ( a nil value)”.

[lua]local function loadWebPage()
native.showWebPopup(10, 50, 300, 350, “http://www.zukagames.com/sports/help.html”, {hasBackground=false} )
end

local function networkListener( event )
if( event.isError ) then
print( "Network error: ", event.response )
else
print( "Status Code: " … event.status )
if event.status == 200 then
print( “Loading web page …” )
loadWebPage()
else
print( “Web page not loaded!” )
end
end
end

network.request( “http://www.zukagames.com/sports/help.html”, “GET”, networkListener )[/lua]

What is happening?  Are you getting an error?

You might want to remove the : and replace it with a colon :  because for that part of the URL, URL encoding is not expected and that’s not valid URL encoding anyway, thats an HTML entity coding and won’t work as part of the URL.

Why are you using network request to fetch the web page and on success fetching the same web page using the web view??

Yes I am getting a error. I am getting the same error for all my network requests and download requests. I was not getting this error with older builds but with the most recent builds I started getting the error.

This is the error I am getting: “attempting to call field ‘request’ ( a nil value)”

I dont know why the colon was changed when I copied from my code to the forum but the URL is corect with a collon. It does not have that other stuff in my code.

Thanks for the help Rob

We upgraded the network API a few daily builds ago to network 2.0.  There are a few changes that may be required.  Make sure to check out the daily builds documentation and see if that helps.

Though frankly, it appears that based on the error, something has overwritten the “network” API since it sounds like the request method isn’t there any more.

I have check out the daily builds document. I just don’t understand the error

Rob Thank you for all your help. I figured it out. I had a old Lua file named network. Once I got rid of that file it all works.

Thanks Again

Alberto

What is happening?  Are you getting an error?

You might want to remove the : and replace it with a colon :  because for that part of the URL, URL encoding is not expected and that’s not valid URL encoding anyway, thats an HTML entity coding and won’t work as part of the URL.

Why are you using network request to fetch the web page and on success fetching the same web page using the web view??

Yes I am getting a error. I am getting the same error for all my network requests and download requests. I was not getting this error with older builds but with the most recent builds I started getting the error.

This is the error I am getting: “attempting to call field ‘request’ ( a nil value)”

I dont know why the colon was changed when I copied from my code to the forum but the URL is corect with a collon. It does not have that other stuff in my code.

Thanks for the help Rob

We upgraded the network API a few daily builds ago to network 2.0.  There are a few changes that may be required.  Make sure to check out the daily builds documentation and see if that helps.

Though frankly, it appears that based on the error, something has overwritten the “network” API since it sounds like the request method isn’t there any more.

I have check out the daily builds document. I just don’t understand the error

Rob Thank you for all your help. I figured it out. I had a old Lua file named network. Once I got rid of that file it all works.

Thanks Again

Alberto