GnomeSequencer StepFunction Explained

Using the StepFunction that is in the example GS script…

StepFunction = [[
	limit = limit or 1
	if step == limit then
		limit = limit % #macros + 1
		step = 1
	else
		step = step % #macros + 1
	end
]],

The lines that will be executed per button press are these…

Button
Press	Line
1	1
2	1
3	2
4	1
5	2
6	3
7	1
8	2
9	3
10	4
11	1
etc.

You can verify my assertion using this script…

Sequences["TenserExample"] = {
    -- StepFunction optionally defines how the step is incremented
    --  when pressing the button.
    -- This example increments the step in the following order:
    --  1 12 123 1234 etc. until it reaches the end of the 
    --  body macro and starts over
StepFunction = [[
	limit = limit or 1
	if step == limit then
		limit = limit % #macros + 1
		step = 1
	else
		step = step % #macros + 1
	end
]],
PreMacro = [[
/run print("-- PreMacro Script --")
/run print("these lines will not")
/run print("be stepped through.")
]],
'/run print("body macro 1")',
'/run print("body macro 2")',
'/run print("body macro 3")',
'/run print("body macro 4")',
 PostMacro = [[
/run print("-- PostMacro Script --")
/run print("these lines will not")
/run print("be stepped through.")
]],
}