Returning

Returning is simple, yet difficult. Returning is when you return a value from a function. A example is provided below.

local function MyFunction()
print("hi")
return "Whats up?"
end

local GetReturn = MyFunction()
print (GetReturn)

This code might look like it will print hi, but it will not. What we are doing is we made the function not only print hi, but return "Whats up?". This means that the functions value is "Whats up?". Therefore, if we make a variable that is equal to the function, and print the variable. We will get "Whats up?" Instead of "hi".

Last updated