So, I've noticed in some more, "advanced" code I've read through, there is an argument called return. I'm just starting out with Lua coding, I've asked friends but haven't really understood the function of the argument. Can someone clarify what "return" does?
The return
keyword is used in functions to send data back to the place where the function was called. Here is an example:
function divideBy(x,y) --initiate a function to divide x by y. return x/y --send the answer back to the place the function was called. end local division=divideBy(155,5) --division is now equal to 31! print(division)
You can learn more about the return
keyword here. I hope this helped!