Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How can i return to a line?

Asked by 10 years ago

How can i return to a line in a script?

1 answer

Log in to vote
0
Answered by
User#2 0
10 years ago

There isn't a way to "return" to a line, not in Lua 5.1 (the base version of lua ROBLOX uses).

BUT, you can use something, such as a function or a loop to repeat something, essentially going over the lines in the function's or loop's scope an amount of times.

function SomeFunc()
    print("I have been executed!")
end

SomeFunc() --> I have been executed!
SomeFunc() --> I have been executed!
SomeFunc() --> I have been executed!
for i = 1, 3 do
    print("For loop output")
end -- Would print "For loop output" to the console 3 times

local x = 0
while x < 10 do
    print("While loop output")
    x = x + 1
end -- Would print "While loop output" 10 times
Ad

Answer this question