Does any one know why this would happen?
Thanks. [import]uid: 66859 topic_id: 18910 reply_id: 318910[/import]
Does any one know why this would happen?
Thanks. [import]uid: 66859 topic_id: 18910 reply_id: 318910[/import]
I recently had a problem like this, i’ll explain what my plight on the matter and you can tell us whether thats similar to your code.
Predeclaring locals. (Outside of functions)
local varName01 = display.newImageRect(...)
--Within the function
...(However you reference your objects)
And then referencing them within a function, you can only reference 60 upvalues per function.
The way i got around it is to declare these locals in a table like so.
local varTable = {varName01, varName02, varName03 ...}
--Within the function or whatever.
varTable.varName01 = ... (i.e: display.newImageRect(...))
and then that table only then counts as a single upvalue.
(Of course you can create multiple tables, partitioning your objects.)
I believe thats how it goes.
Sound familiar?
[import]uid: 91798 topic_id: 18910 reply_id: 72844[/import]
I’ve come across more than 60 upvalues errors too, and it happened when I judiciously forward referenced all my variables up top. I used to do so, thinking it was the right thing to do. But then, when I googled “more than 60 upvalues”, I found all sorts of good information that I’ve never knew about.
The bottom line is, I learned it’s not always a good idea to keep all variables forward referenced up top, but do it a bit more consciously and selectively.
Try googling the phrase. I learned so much doing so. And learning about the concept of scope in programming will help quite a bit too.
There are some wonderful blog posts, etc., that I’ve come across while on forum regarding this. If I can dig them up, I’ll post the link(s) (and others might already have them handy).
Naomi [import]uid: 67217 topic_id: 18910 reply_id: 72848[/import]
Here are a couple of links:
http://developer.anscamobile.com/forum/2011/10/14/understanding-scope-blog-post
http://developer.anscamobile.com/forum/2011/09/30/modules-and-scope-variables#comment-58306
Edit: a couple more from googling:
http://lua-users.org/lists/lua-l/2008-08/msg00488.html
http://wow.incgamers.com/forums/showthread.php?t=414407
(scroll down to a post by the user named Telic)
Naomi
[import]uid: 67217 topic_id: 18910 reply_id: 72850[/import]
@thehivetyrant: That is it! Thanks!
@Naomi: Thank you for the resources 
[import]uid: 66859 topic_id: 18910 reply_id: 72864[/import]