for i, v = 0.1, -1 do -- Code goes here, but I can't figure out how to make it do like for example i, and v. Into one. end
I do that, and it errors.
There are two types of for
loops.
The numeric for
loop goes over a range of numbers. It looks like this:
for count = start, stop do
The generic for
loop uses an iterator to generate a bunch of values. It looks like this:
for a, b, c, d in expr do
If you're using a numeric for
loop, there's only one variable.
for i = 0.1, -1 do
It will step by 1
however -- and -1
is smaller than 0.1
so your loop won't do anything at all. You need to specify how much you step by, the third thing:
for i = 0.1, -1, -0.1 do
This will use i
as 0.1
, 0
, -0.1
, -0.2
, ..., -0.9
, -1