Closed
Description
Recently there seems to be some confusion about what values functions should return when they encounter an error.
Historically, the following has been the general policy; (1):
- On failure, all functions should return false.
Somewhere along the way we realised functions that ordinarily return booleans (isPedDead, hasObjectPermissionTo, etc) should not return meaningful values (false
) when errors are encountered, so we started doing something else for new functions; (2):
- If a successful function call would return a boolean value, a failed call should return
nil
. - Otherwise, all other failed function calls return
false
.
Some new functions / pull requests have started to do something else; (3):
- Always return
nil
on failure, no matter the return type.
Things to pin down:
- Pick a system
- Stick to the current system (2)
- Begin adopting (3)?
- Something else?
- Do we want to modify old functions or should this only apply to new functions?