Can someone explain returns to me plz? The wiki makes no sense to me.
✓ ANSWER ACCEPTED
How to use Returns?
1 answer
✓ Accepted answer
Returning is a way to get info out of a function. Let me give you an example:
function Add(a,b)
return a+b
end
This will take two numbers and add them together, then return the result.
So if we do this:
Add(1,3)
Lua will read it as '4'
Here's a full example:
function Add(a,b)
return a+b
end
print(Add(2,5)) --this will print 7
You can also return booleans and strings. Returning is useful for functions that 'check' whether something is true, or return a string based on user input.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
"return" replaces where the function was called with whatever you put after the return statement.