Relative Content

Tag Archive for loopslua

Optimizing Loops

I am trying to optimize using for loops. Right now I use nested IF statements for most things and I would like to clean that up and begin replacing a lot of that messy code with for loops. In this example I have nested arrays. What I am trying to do is have a loop that evaluates each array under shapes and when it finds a value that matches with choice, it returns the shape name (triangle, square, or circle) which in the particular case would be square. The following has not worked obviously so I am hoping someone can help correct me and teach me where I went wrong.