I hope I didn’t seem like I was yelling at you above. I know that folks new to game development and or programming may be used to linear execution of their scripts and programs, but unaware of asynchronous operations.
Generally and usually, lines of code execute synchronously (in order): 1, 2, 3, 4, …
Typically, you can rely on step 1 completing before step 2, step 2 before step 3, and so on.
However, that is not always true. Point in case, the function you are calling display.loadRemoteImage() is not a synchronous feature.
It is asynchronous. https://www.merriam-webster.com/dictionary/asynchronous
Additionally, it is non-blocking. (More on both topics here: https://stackoverflow.com/questions/7931537/whats-the-difference-between-asynchronous-non-blocking-event-base-architectu)
In a nutshell, display.loadRemoteImage(), executes immediately (non-blocking), but the work done as a result will happen some time in the future (asynchronously).
As you get more familiar with game dev in particular, and if you choose to make games with any of these features:
- Game Services (Google Play, iOS, Steamworks)
you will encounter more and more asynchronous operations. This is something you have to fully grok to handle properly and hide from your users in some cases.
Anyways, best of luck to you on your game dev journey.
PS - As a bonus, be aware, if you are not already, that Corona/Solar2D is event-based. Thus, the listener to handle the asynchronous call above.