I’m trying to define some parameters in config.lua to use throughout my program. Needless to say it isn’t working.
In config.lua I placed the following
mySettings =
{
enabled=true,
},
I then attempt to reference it in main.lua using:
application.particleCandySettings.enabled
No dice… any ideas? Thanks! [import]uid: 16901 topic_id: 21108 reply_id: 321108[/import]
I’m not sure I followed your explanation of how your’re trying to use the code, correctly but it seems you’re attempting to do:
File: config.lua
mySettings =
{
enabled=true,
},
File: main.lua
if application.particleCandySettings.enabled then
--code stuff here
end
but config.lua don’t really work that way, you’re not actually telling lua to set application.particleCandySettings.enabled to anything.
Another point to make is that you probably shouldn’t use config.lua for custom code, it’s a settings file for corona and may have unintended issues if you place non data inside
You’d need something more like:
File: myCustomConfig.lua
mySettings =
{
enabled=true,
},
File: main.lua
[code]
require (“myCustomConfig”)
application.particleCandySettings.enabled = mySettings.enabled
[/code] [import]uid: 8838 topic_id: 21108 reply_id: 83516[/import]
Okay… that all makes sense. Thanks! [import]uid: 16901 topic_id: 21108 reply_id: 83547[/import]