Network Server?

Is it possible to store a variable or an entire individual script file in a server, and in the code for the individual devices running the app access these variables and add/subtract from them?

Of course, this is what every browser does. Mobile apps are no different. Take a look at the network.* documentation. You would need a server to run the web service.

Hi Roth,

I use something like this to talk to my server. I have ASP.NET scripts in the server (but it can be in any language) that return a JSON file to may App. In this example bellow, I’m illustrating the code to get the score stored for a specific user.

 local function networkListener( event ) if ( event.isError ) then print( "Network error!") else print("user score is: " .. event.response.score) end end local link = "http://www.mywebsite.com/getscore.aspx?userid=1001" local headers = {} headers["Content-Type"] = "application/json" local params = {} params.headers = headers network.request( link, "GET", networkListener, params)

Just be careful because Apple does not allow you to run a code that is stored outside of your app (it is a big security risk).

Depending where in the code you do that, you wouldn’t pass the Apple validation submission.

Corona won’t allow remote code to be executed anyway because of this Apple restriction.  You can however save information about levels and such in a data structure maybe in JSON data and download that and use those values to determine properties for your levels.

Rob

Of course, this is what every browser does. Mobile apps are no different. Take a look at the network.* documentation. You would need a server to run the web service.

Hi Roth,

I use something like this to talk to my server. I have ASP.NET scripts in the server (but it can be in any language) that return a JSON file to may App. In this example bellow, I’m illustrating the code to get the score stored for a specific user.

 local function networkListener( event ) if ( event.isError ) then print( "Network error!") else print("user score is: " .. event.response.score) end end local link = "http://www.mywebsite.com/getscore.aspx?userid=1001" local headers = {} headers["Content-Type"] = "application/json" local params = {} params.headers = headers network.request( link, "GET", networkListener, params)

Just be careful because Apple does not allow you to run a code that is stored outside of your app (it is a big security risk).

Depending where in the code you do that, you wouldn’t pass the Apple validation submission.

Corona won’t allow remote code to be executed anyway because of this Apple restriction.  You can however save information about levels and such in a data structure maybe in JSON data and download that and use those values to determine properties for your levels.

Rob

Ohh I see, so you can’t run external code outside of your app, but you can use information from outside your app like the level a player is on or something. Thanks!

Ohh I see, so you can’t run external code outside of your app, but you can use information from outside your app like the level a player is on or something. Thanks!