attempt to index global 'network' (a nil value)

Hello,

We’re using CoronaCards on iOS. As you can see from the title We’re getting this error:

attempt to index global ‘network’ (a nil value)

I tried moving the “network.download()” call to be the very first line in the main.lua file and still the issue remains. From reading similar issues, it says that something has overridden the “network” variable, but nothing really had the chance to do so as it was the very first line.

Viewing all the variables like so:

for k,v in pairs(_G) do

  print(k,v)

end

I see every other GLOBAL variable, but no network.

Really need help understanding at what point network is being declared and what could override it?

Thank you,

Mars

Hi Mars, I’m trying to determine why this is the case.

I built a minimal CoronaCards sample app and network calls worked fine.

I added the code fragment you included above and I see many globals including:

2017-06-14 12:42:48.705934-0700 Sample Cards Project[8064:4494803] tonumber function: 0x17404afb0 2017-06-14 12:42:48.705949-0700 Sample Cards Project[8064:4494803] network table: 0x17026e380 2017-06-14 12:42:48.706004-0700 Sample Cards Project[8064:4494803] io table: 0x1742634c0

I’m using CoronaCards 2017.3079 for iOS.  What version are you using?

You could override the network library with a line of code like:

local network = nil

but you say you moved the call to the first line of main.lua so this doesn’t seem to be the cause.

Can you send me a small Xcode project that demonstrates the problem?

Thank you for the fast reply.

My project has gotten really big, it is very hard to take a part of it to show you.

I have downloaded downloaded CoronaCrads from the main download page and not sure which version I have. I’ve attempted to download the most recent version and replace it with my current one. But, trying to build the project again I get an “Apple Match-O Linker Error”.

Is there a way to see which version I have, and/or to fix the Match-O Linker error?

Does the problem with the  network  library happen if you build a simple test app?

When you run your project in Xcode a line like this which includes the version will get logged to the Xcode debug console:

Platform: iPhone / x86\_64 / 10.3 / Apple Software Renderer / OpenGL ES 2.0 APPLE-14.0.15 / 2017.3079 / en | US | en\_US | en

We always need to know the version of Corona you are using.  You mention two different versions in your post but don’t say what either of them is.  Also, in this case, the version of Xcode would be useful.

To help you with linker errors, I’ll need to see copy and pasted text from the errors with enough context to see what’s going on.  You may want to use Xcode’s “Report Navigator” to get a clearer view of the errors:

Ok, so,

I build a simple CoronaCards project and I WAS able to make a network request.

I am using version:

First_iOS_FullScreen_Corona[53946:14700180] Platform: iPhone / x86_64 / 10.3.1 / Apple Software Renderer / OpenGL ES 2.0 APPLE-14.0.15 / 2016.2992 / en | US | en_US | en

The question now is, what does this mean?

Is there a way to view what is being loaded initially when the CoronaCards is added to my other project, to find out if “network” is there?

Are there any settings/restrictions that I might have placed to block “network”? 

I also ran the GLOBALs test again, and found that there are only 2 global variables missing:

  1. network

  2. _network_pathForFile

Everything else is the same…

I was able to reproduce your problem by putting a file called network.lua in my Corona project.  Do you have a file with that name?

Hello again,

No. I do not have any files named network.lua  or any file named  network.*.

  1. Is there a way I can see if it’s ever loaded properly when CoronaCards is loaded?

  2. Is there a  network model you can provide me with to require instead?

Another issue we are experiencing:

On iPad in Landscape mode, CoronaCards is reading the touch in the wrong way. So I created a fullscreen see-through Rect and a Circle that shows Corona’s X and Y of the event.

Look at the video here: https://youtu.be/RJYcEVbgy8I

Iv’e place my code in the description,

Please please please help,

Mars

Hi Mars, I’m trying to determine why this is the case.

I built a minimal CoronaCards sample app and network calls worked fine.

I added the code fragment you included above and I see many globals including:

2017-06-14 12:42:48.705934-0700 Sample Cards Project[8064:4494803] tonumber function: 0x17404afb0 2017-06-14 12:42:48.705949-0700 Sample Cards Project[8064:4494803] network table: 0x17026e380 2017-06-14 12:42:48.706004-0700 Sample Cards Project[8064:4494803] io table: 0x1742634c0

I’m using CoronaCards 2017.3079 for iOS.  What version are you using?

You could override the network library with a line of code like:

local network = nil

but you say you moved the call to the first line of main.lua so this doesn’t seem to be the cause.

Can you send me a small Xcode project that demonstrates the problem?

Thank you for the fast reply.

My project has gotten really big, it is very hard to take a part of it to show you.

I have downloaded downloaded CoronaCrads from the main download page and not sure which version I have. I’ve attempted to download the most recent version and replace it with my current one. But, trying to build the project again I get an “Apple Match-O Linker Error”.

Is there a way to see which version I have, and/or to fix the Match-O Linker error?

Does the problem with the  network  library happen if you build a simple test app?

When you run your project in Xcode a line like this which includes the version will get logged to the Xcode debug console:

Platform: iPhone / x86\_64 / 10.3 / Apple Software Renderer / OpenGL ES 2.0 APPLE-14.0.15 / 2017.3079 / en | US | en\_US | en

We always need to know the version of Corona you are using.  You mention two different versions in your post but don’t say what either of them is.  Also, in this case, the version of Xcode would be useful.

To help you with linker errors, I’ll need to see copy and pasted text from the errors with enough context to see what’s going on.  You may want to use Xcode’s “Report Navigator” to get a clearer view of the errors:

Ok, so,

I build a simple CoronaCards project and I WAS able to make a network request.

I am using version:

First_iOS_FullScreen_Corona[53946:14700180] Platform: iPhone / x86_64 / 10.3.1 / Apple Software Renderer / OpenGL ES 2.0 APPLE-14.0.15 / 2016.2992 / en | US | en_US | en

The question now is, what does this mean?

Is there a way to view what is being loaded initially when the CoronaCards is added to my other project, to find out if “network” is there?

Are there any settings/restrictions that I might have placed to block “network”? 

I also ran the GLOBALs test again, and found that there are only 2 global variables missing:

  1. network

  2. _network_pathForFile

Everything else is the same…

I was able to reproduce your problem by putting a file called network.lua in my Corona project.  Do you have a file with that name?

Hello again,

No. I do not have any files named network.lua  or any file named  network.*.

  1. Is there a way I can see if it’s ever loaded properly when CoronaCards is loaded?

  2. Is there a  network model you can provide me with to require instead?

Another issue we are experiencing:

On iPad in Landscape mode, CoronaCards is reading the touch in the wrong way. So I created a fullscreen see-through Rect and a Circle that shows Corona’s X and Y of the event.

Look at the video here: https://youtu.be/RJYcEVbgy8I

Iv’e place my code in the description,

Please please please help,

Mars