24.03.2013, 16:49
(
Последний раз редактировалось Slice; 09.04.2013 в 14:06.
)
This adds try/catch statements to Pawn, very similar to those in other languages.
A good usage area is commands. The player who typed the command wants to know why the command failed. Why it failed, however, could be due to an error inside a function inside nested calls.
Normally when functions fail they just return 0, -1, or something similar. While that works in many cases, sometimes you want to inform the user of where and why it went wrong.
Refer to the tutorial for more information.
Code: https://github.com/oscar-broman/exceptions (be sure to look at this topic for updates)
A good usage area is commands. The player who typed the command wants to know why the command failed. Why it failed, however, could be due to an error inside a function inside nested calls.
Normally when functions fail they just return 0, -1, or something similar. While that works in many cases, sometimes you want to inform the user of where and why it went wrong.
Refer to the tutorial for more information.
Code: https://github.com/oscar-broman/exceptions (be sure to look at this topic for updates)