infinite loop I need some help

jbp1 – The best in the world!

yes!

it works!!!

thank you, thank you very much.

I’m going to star working on my new app now.

this is just the beginning.

Thank you one more time

your friend

Victor


after reading the code.


the actual loop is inside the doMore function.

for n = 1, 100

so inside the loop, you just call the function (1, 2, 3, 4, 5 and so on…untill you reach 100)

you are not making the “object”


now you have a function to make the objects.

–is there any reason why you did

makeNewBall = function()

instead of

function makeNewBall()

now, I don really get this line, why?

count = count + 1

also, you create the object, display, the position x, y and so on

but at the end you put

return ball

what is exactly the “return”

I don’t get this concept of return.

I’ve seen it many times, I just don’t understand it.


then on the finishTransition you put – obj – inside the parenthesis

I though that was only for

– obj - event.target

where did you get the  – obj – from?


now finally in the cleanUp function you put

count = count - 1

i don’t get it. why - 1?


last 2 questions –

how long have you been programming?

and where did you learn all this?

Some of this is left-over from debugging of the code …

and I’m not all that fluent in Lua yet, so maybe this would work by just defining “function makeNewBall” instead of the forward declaration (“local makeNewBall”).  It just comes out from the fact that there is a circular dependency among the 3 functions … so we first tell Lua that there is thing called “makeNewBall” and don’t worry, we’ll define it later (which is the “makeNewBall = function()” part).  

The “count” stuff is just for debugging … making sure that the count goes to zero in between each transition.

The “return ball” part of makeNewBall is just if you want to keep track of individual objects in some other array (like in your original code).  In doMore, you could add something like “ball[i] = makeNewBall()”.  But you’d need to do some more work to capture the objects created by the cleanUp function – timer.performWithDelay just executes the function you give it, it can’t do anything with a return value from that function.  

You could potentially use a file-local variable (array) and the count variable and store the circle objects inside the makeNewBall function.  Or you could just add each ball to a new displayGroup, then look at the children of that group (i.e. let Corona track the objects for you).

thanks…

I’m going to keep studying a lot more…

I hope I can really understand the concept really well…one day.

for now the code works really good

thank you jbp1