Hello, I have a lua-scripting question:
I have a vector called answord of very big length (think over 100 entries) where each entry is a letter. The vector starts at index 0. I also have a variable called length which tells me how many of these letters I want to display on screen. Right now my code looks like this:
if length==1 then gui.text(10,10,"Answer: " .. answord[0]) end
if length==2 then gui.text(10,10,"Answer: " .. answord[0] .. answord[1]) end
if length==3 then gui.text(10,10,"Answer: " .. answord[0] .. answord[1] .. answord[2]) end
if length==4 then gui.text(10,10,"Answer: " .. answord[0] .. answord[1] .. answord[2] .. answord[3]) end
if length==5 then gui.text(10,10,"Answer: " .. answord[0] .. answord[1] .. answord[2] .. answord[3] .. answord[4]) end
I think you get the picture. Remember that the value of length can be quite big, so I need quite a few of these if:s if I want to solve it this way. Is there a nice way to do this without having to write one "if" for each possible value of the length? Perhaps this can be done with a for-loop somehow, but I'm not sure how... help is appreciated!