It appears that Corona has a limit (100) on the number of local variables you can declare in lua file. Is there any way around this? [import]uid: 135391 topic_id: 33601 reply_id: 333601[/import]
Hey, @nate2, you could try grouping your local variables into tables. That’s how I do it with bazillions of variables I need in my game. So instead of adding each variables as [text]local myVariable1[/text], [text]local myVariable2[/text], etc., I’d do something like the following for all buttons and images, for example.
-- by doing the following, I end up using 2 (instead of 6 for example):
local btn = {}
btn.goBack
btn.goHome
btn.goNext
--etc. etc.
local img = {}
img.background
img.image1
img.image2
img.image3
-- etc. etc.
I hope this helps.
(BTW, I thought the limit was 200…?)
Naomi
[import]uid: 67217 topic_id: 33601 reply_id: 133578[/import]
@Naomi, what a great way to use and also organize our variables.
Thanks for sharing,
Rodrigo.
@RSCdev [import]uid: 89165 topic_id: 33601 reply_id: 133581[/import]
I’m so glad to share it, Rodrigo. I was super happy when I figured this one out when I hit the limit way back when. I never had any issue with organizing my variables this way. Also it helps to know what type of variable they are.
Cheers,
Naomi [import]uid: 67217 topic_id: 33601 reply_id: 133583[/import]
Yes, right, the limit is 200.
Thanks for the table suggestion, Naomi! That should do the trick. [import]uid: 135391 topic_id: 33601 reply_id: 133584[/import]
Good luck with your project, @nate2!
Naomi [import]uid: 67217 topic_id: 33601 reply_id: 133589[/import]
Thanks Naomi! I did something similar on my current and first app (in review now by the way!) I was hitting that limit and end up having a combination of regular variables and “table” variables. I like the way you do it and I will copy it if you do not mind:)
Until I found the table way, I was killing myself by trying decide which variable I can and cannot live without!
Cheers.
Mo [import]uid: 100814 topic_id: 33601 reply_id: 133612[/import]
Hey, Mo @LairdGames, I don’t mind at all. I also do txt={} for all text objects, group={} for display groups, and… something like award={} for award related variables & functions, etc. etc. etc. I just love the power of Lua tables. It can hold anything, it feels like.
And congrats with submitting your first app!! That’s so exciting.
Naomi [import]uid: 67217 topic_id: 33601 reply_id: 133619[/import]
Yes it is but nerve shattering this weekend. I sent it to some beta testers this weekend for final check and boom some reported a crash at startup! Thinking it was maybe my Revmob integration (not Revmob itself) I removed all the monetization code (and so now I need to make the app paid) But by the end of the night, I found out the crash was due to some beta testers loading the newest beta version on top of the older one. Once they deleted the previous one, the app start working!
In the meantime I HAD to sent the app to Apple yesterday because I am traveling for business all these week and no Mac access! With the cutoff date fast approaching I decided it was better to release the app before Christmas rather than risk adding back Revmob and miss the deadline! I would have loved keeping the app free with Revmob since it would have had more downloads than a paid app but what can you do!
Fantastic suggestions about text, and groups! I really did not think about those even so I have millions of text fields! It is amazing how the number of variables grows…
In any event thank you so much for those great suggestions. You can be assure that the way I will work from now on:)
Mo [import]uid: 100814 topic_id: 33601 reply_id: 133623[/import]
Wow, Mo, what a wild weekend you’ve had. I’m on my last leg of my new game right now – adding sound effects (what a pain, going through bazillions of sound files – if only I can be a musician too, but that just isn’t happening), doing more polishing here and there, etc. And it’s all about the game itself. I haven’t even implemented interstitial ads. My goal now is to submit my new game before iTunes shuts down, go on a nice long vacation, and then hopefully, by the time I’m back, it’s ready for release.
Have a great & successful business trip!
Naomi
[import]uid: 67217 topic_id: 33601 reply_id: 133628[/import]
Thanks Naomi! Yes, I learned the hard way that the last 10% of the app takes 90% of the time! Don’t forget to put a note on the Corona Indies Facebook page when you ready to ask for reviews. It will be my pleasure to review your new game!
Mo [import]uid: 100814 topic_id: 33601 reply_id: 133635[/import]
Hey, @nate2, you could try grouping your local variables into tables. That’s how I do it with bazillions of variables I need in my game. So instead of adding each variables as [text]local myVariable1[/text], [text]local myVariable2[/text], etc., I’d do something like the following for all buttons and images, for example.
-- by doing the following, I end up using 2 (instead of 6 for example):
local btn = {}
btn.goBack
btn.goHome
btn.goNext
--etc. etc.
local img = {}
img.background
img.image1
img.image2
img.image3
-- etc. etc.
I hope this helps.
(BTW, I thought the limit was 200…?)
Naomi
[import]uid: 67217 topic_id: 33601 reply_id: 133578[/import]
@Naomi, what a great way to use and also organize our variables.
Thanks for sharing,
Rodrigo.
@RSCdev [import]uid: 89165 topic_id: 33601 reply_id: 133581[/import]
I’m so glad to share it, Rodrigo. I was super happy when I figured this one out when I hit the limit way back when. I never had any issue with organizing my variables this way. Also it helps to know what type of variable they are.
Cheers,
Naomi [import]uid: 67217 topic_id: 33601 reply_id: 133583[/import]
Yes, right, the limit is 200.
Thanks for the table suggestion, Naomi! That should do the trick. [import]uid: 135391 topic_id: 33601 reply_id: 133584[/import]
Good luck with your project, @nate2!
Naomi [import]uid: 67217 topic_id: 33601 reply_id: 133589[/import]
Thanks Naomi! I did something similar on my current and first app (in review now by the way!) I was hitting that limit and end up having a combination of regular variables and “table” variables. I like the way you do it and I will copy it if you do not mind:)
Until I found the table way, I was killing myself by trying decide which variable I can and cannot live without!
Cheers.
Mo [import]uid: 100814 topic_id: 33601 reply_id: 133612[/import]
Hey, Mo @LairdGames, I don’t mind at all. I also do txt={} for all text objects, group={} for display groups, and… something like award={} for award related variables & functions, etc. etc. etc. I just love the power of Lua tables. It can hold anything, it feels like.
And congrats with submitting your first app!! That’s so exciting.
Naomi [import]uid: 67217 topic_id: 33601 reply_id: 133619[/import]
Yes it is but nerve shattering this weekend. I sent it to some beta testers this weekend for final check and boom some reported a crash at startup! Thinking it was maybe my Revmob integration (not Revmob itself) I removed all the monetization code (and so now I need to make the app paid) But by the end of the night, I found out the crash was due to some beta testers loading the newest beta version on top of the older one. Once they deleted the previous one, the app start working!
In the meantime I HAD to sent the app to Apple yesterday because I am traveling for business all these week and no Mac access! With the cutoff date fast approaching I decided it was better to release the app before Christmas rather than risk adding back Revmob and miss the deadline! I would have loved keeping the app free with Revmob since it would have had more downloads than a paid app but what can you do!
Fantastic suggestions about text, and groups! I really did not think about those even so I have millions of text fields! It is amazing how the number of variables grows…
In any event thank you so much for those great suggestions. You can be assure that the way I will work from now on:)
Mo [import]uid: 100814 topic_id: 33601 reply_id: 133623[/import]
Wow, Mo, what a wild weekend you’ve had. I’m on my last leg of my new game right now – adding sound effects (what a pain, going through bazillions of sound files – if only I can be a musician too, but that just isn’t happening), doing more polishing here and there, etc. And it’s all about the game itself. I haven’t even implemented interstitial ads. My goal now is to submit my new game before iTunes shuts down, go on a nice long vacation, and then hopefully, by the time I’m back, it’s ready for release.
Have a great & successful business trip!
Naomi
[import]uid: 67217 topic_id: 33601 reply_id: 133628[/import]