Is there a way to get this value?

Seems quite useless, but is there a way to get the end value in a for loop?

Like, say I want to do this (pretend this would work at all lollollolollol)

for i = 1, 100 do
 print(i.."/"..i.endvalue)
end

So I’d get a result of “1/100” in the output

Nope. i (for the current iteration) is the only variable in a standard for loop.

You could define a variable to use before initializing the loop though, and just use this:

local var = 100
for i = 1, var do
    print(i .. '/' .. var)
end
3 Likes