[Solved] Help: repeat a function "x" times

Hm, sorry. I think I mixed up things (again), cause lua-for-loops are different to other languages, kinda special :X. Will correct† above.

Yes looks right to me. But don’t know for sure without testing.

Thanks ffx for the help! :slight_smile:

I am simply looking for a simple function to repeat, with repeat and until. For example (with os.clock):

local starttime = os.clock()
print("I'm about to spam you horribly for 1.5 seconds")
repeat
	print("SPAM!")
until os.clock() - starttime > 1.5
print("All done :P")

Very interesant! Repeat a function 1.5 seconds.Instead, I want to repeat only 5 times

Possibly repeat and until does not work, and I must use for and do.

Errr…maybe?

function repeat_x4(song, a) --repeat 4 times with--> repeat until
song = renoise.song()
a = 1
repeat
song:insert_track_at(song.selected_track_index)
a = a + 1
until a > 4
end

jajajaImpressed with speed!!! Perfect and solved!!! Taaaaaaanks 4Tey!!!

The functions:

function amic_CH04_5B(song, a) --repeat x4 with "repeat until"
  song = renoise.song()
  a = 1
  repeat
    song:insert_track_at(song.selected_track_index)
    a = a + 1
  until a > 4
end

function amic_CH04_6B(song, a) --repeat x4 with "for do"
  song = renoise.song()
  a = 4
  for i = 1, a, 1 do
    song:insert_track_at(song.selected_track_index)
  end
end

function amic_CH04_6B(song, a) --repeat x4 with "for do"
  song = renoise.song()
  a = 4
  for i = 1, a do
    song:insert_track_at(song.selected_track_index)
  end
end

Any idea with vertical scrollbar ? :https://forum.renoise.com/t/solved-help-create-an-area-with-vertical-scrollbar-with-buttons-in/47059