reference Config.lua file to an image?

Greetings. I have a question concerning the code below -

display.newImageRect ( "fileName. ext" , config.lua file )

Basically, I am wondering if it is possible to reference the config.lua file for the image size, instead of using display.contentWidth, etc., or, object.xScale, etc., or an actual number. I want to reference the values inside my Config.lua - Is this possible?

I’m sure you could, as the config.lua file is still a lua file and should still operate within the rules of external modules. 

You could also just create a imgsize.lua file that serves the same function as what you outline above. That way you wouldn’t need to worry about messing with the config.lua formatting.

Can you suggest a method of doing that? I’m still learning the LUA language and really don’t know how to approach it. I don’t want just a quick answer though, I would appreciate something that I can look at and learn from, or even be able to reference later. Any suggestions? Thanks again.

Here’s a link to the Corona documentation on external modules:

http://www.coronalabs.com/blog/2011/09/05/a-better-approach-to-external-modules/

It’s pretty simply to implement. Here’s another link to the importance of NOT using globals in Corona coding:

http://www.coronalabs.com/blog/2013/05/28/tutorial-goodbye-globals/

http://docs.coronalabs.com/guide/basics/optimization/index.html

Starting with good code habits is step #1. The forums have TONS of ppl asking the same questions as you, so plenty of help is available.

I’m sure you could, as the config.lua file is still a lua file and should still operate within the rules of external modules. 

You could also just create a imgsize.lua file that serves the same function as what you outline above. That way you wouldn’t need to worry about messing with the config.lua formatting.

Can you suggest a method of doing that? I’m still learning the LUA language and really don’t know how to approach it. I don’t want just a quick answer though, I would appreciate something that I can look at and learn from, or even be able to reference later. Any suggestions? Thanks again.

Here’s a link to the Corona documentation on external modules:

http://www.coronalabs.com/blog/2011/09/05/a-better-approach-to-external-modules/

It’s pretty simply to implement. Here’s another link to the importance of NOT using globals in Corona coding:

http://www.coronalabs.com/blog/2013/05/28/tutorial-goodbye-globals/

http://docs.coronalabs.com/guide/basics/optimization/index.html

Starting with good code habits is step #1. The forums have TONS of ppl asking the same questions as you, so plenty of help is available.