• Waiting between pairs loop iteration
    4 replies, posted
How would I go about doing this? I can post the code I'm working with if need be. Have a table that looks like this: waves = { { normal = 1, fast = 0 }, { normal = 0, fast = 1 }, { normal = 1, fast = 1 } } Trying to print the normal and fast values of each table within waves every X seconds. I'm going to assume I should use a pairs loop. I'm very new to this so sorry if this is a blatantly obvious question. Any suggestions are appreciated, thanks.
As I understand you can do this by print(waves[waveNumber].normal,waves[waveNumber].fast)
look into the timers library. You can delay your prints like that. Just keep track of the table index you want to print next.
I understand how to print out the values and I can go through the table and do so, I'm just having problems creating a timer between each loop to separate the pairs of numbers. Effectively I need this logged: 1, 0 [wait 5s] 0, 1 [wait 5s] 1, 1 [wait 5s, repeat] I know I most likely to modify this basic function using timer.Create, but I'm not sure how I should do this for index, w in pairs(waves) do print(w["normal"]) print(w["fast"]) end
Why do you need #waves in 3rd argument? It makes repeat timer #waves times
Sorry, you need to Log In to post a reply to this thread.