Corona SDK Pro Tip of the Day #29
App specific variables
All Corona applications have names, App Store id, Google Play id and some other app specific variables.
I define them in my
main.lua and use all over my code when needed.
main.lua has this code somewhere near the top:
local app = require('lib.app') app.name = '2048 Hex' app.font = 'GlasnostDemibold' app.fontbold = native.systemFontBold app.iOSID = '841721448' app.androidID = 'com.spiralcodestudio.hexled'
app.name is used in my function that shows alerts as well as for social media sharing.
Font names are used in every
Store IDs are used for "Rate" buttons and other stuff.
I can keep there some other identifiers if I have. Like for ads or partnership networks.
If you have some explicit identifier in you code more than in one place - replace it with a variable. You may forget to change it in all places when you'll need it.