config.lua running multiple times?

Is it expected behavior that config.lua will run multiple times across the lifetime of an application?

I noticed recently when adding in the steamworks plugin that the config file ran once at the beginning of the application and again when the steamworks plugin was required.

I just wanted to make sure that this was nothing to be alarmed by.

Cheers,

Ian

How did you determine it was ‘running’?  That sounds wrong to me, but I’m unclear on how you could check for this.

PS - Not doubting, just genuinely curious.

PPS - Also, better tell us the following:

  • On Simulator or Device
  • Windows or OS X Simulator
  • Release of Corona (ex: v2016.3011)

Well I have a couple print statements in the config file to log the device’s screen size and aspect ratio, which get used later for calculating the app width and height. Essentially just this:

_AR = display.pixelHeight / display.pixelWidth

print( "Device Pixel Height: " … display.pixelHeight )

print( "Device Pixel Width: " … display.pixelWidth )

print( "Device aspect ratio: " … _AR )

And I noticed it printing this information out again after I required the plugin and thought that was strange.

That is interesting.  

I am looking forward to others’ responses and findings.

Please provide these details to help advance the discussion:

  • On Simulator or Device - My guess is this is in the simulator, right?
  • Windows or OS X Simulator
  • Release of Corona (ex: v2016.3011) you are using

I am currently running on the OS X simulator with v2017.3023

I really doubt it, though it could be that the config is loaded as a resource which the underlying Corona application code refers to occasionally. Have you been able to repeat the situation with a simple app/minimal code?

It will reproduce if you add the following to the first line of config.lua in the sample steamworks app that corona provides:

print( “The config file is running” )

You will see “The config file is running” printed twice.

The steamworks plugin loads config.lua to find the application.steamworks.appId key. 

There is an expectation that at the end of the day, there is nothing going on more than returning the application table with values that Corona uses. I would expect that if you’re using things like Goggle push notifications or anything that needs a google license key, you may very well see your prints execute twice then as well.

Rob

How did you determine it was ‘running’?  That sounds wrong to me, but I’m unclear on how you could check for this.

PS - Not doubting, just genuinely curious.

PPS - Also, better tell us the following:

  • On Simulator or Device
  • Windows or OS X Simulator
  • Release of Corona (ex: v2016.3011)

Well I have a couple print statements in the config file to log the device’s screen size and aspect ratio, which get used later for calculating the app width and height. Essentially just this:

_AR = display.pixelHeight / display.pixelWidth

print( "Device Pixel Height: " … display.pixelHeight )

print( "Device Pixel Width: " … display.pixelWidth )

print( "Device aspect ratio: " … _AR )

And I noticed it printing this information out again after I required the plugin and thought that was strange.

That is interesting.  

I am looking forward to others’ responses and findings.

Please provide these details to help advance the discussion:

  • On Simulator or Device - My guess is this is in the simulator, right?
  • Windows or OS X Simulator
  • Release of Corona (ex: v2016.3011) you are using

I am currently running on the OS X simulator with v2017.3023

I really doubt it, though it could be that the config is loaded as a resource which the underlying Corona application code refers to occasionally. Have you been able to repeat the situation with a simple app/minimal code?

It will reproduce if you add the following to the first line of config.lua in the sample steamworks app that corona provides:

print( “The config file is running” )

You will see “The config file is running” printed twice.

The steamworks plugin loads config.lua to find the application.steamworks.appId key. 

There is an expectation that at the end of the day, there is nothing going on more than returning the application table with values that Corona uses. I would expect that if you’re using things like Goggle push notifications or anything that needs a google license key, you may very well see your prints execute twice then as well.

Rob