Forum
CS2D Scripts What is Return 1 and how do I use Return 1What is Return 1 and how do I use Return 1
2 replies 1
returnkeyword: https://www.lua.org/pil/4.4.html
So simply,
return 1will return the number 1 to the function's caller.
But I'm being ignorant by simply telling you that, I know what you mean.
I simply wanted you to understand that
return 1isn't a magical CS2D super programming spell.
In some of the CS2D hooks, a return value is accepted.
Example of a hook with a return value: hitzone
This hook specifies what it expects to receive and what it will do when receiving that value.
The values of which are documented at the bottom of the page under "returned values".
CS2D's most common return value is 1, which usually means "stop" or "cancel" whilst 0 is the opposite, "continue".
But this isn't always applicable, so read the documentation of the hook to learn what to return and when, depending on the task at hand.
On the other hand, hooks such as second will not accept any returned values, as it just wouldn't make any sense.
Why would you want to stop the second hook for example?
This should give you enough context and information to hopefully understand what returning does in CS2D hooks.
edited 1×, last 21.01.22 11:18:36 am
1