Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unneeded setter return values #12179

Merged
merged 3 commits into from
Apr 10, 2022

Conversation

appgurueu
Copy link
Contributor

Fixes #12177. I consider return values unneeded when:

  • It's a true boolean indicating success
  • It's undocumented
  • The only case in which a falsy return value (can be nothing) is returned is an invalid player object, which should be checked against using is_player() instead

@appgurueu
Copy link
Contributor Author

appgurueu commented Apr 6, 2022

I've found no push* within the set_look_* funcs (or any of the called funcs) and testing shows that these functions return nothing on success. I therefore have to assume that the 1 is incorrectly returned.

@rubenwardy rubenwardy added @ Script API Trivial The change is a trivial bug fix, documentation or maintenance change, as per the Git Guidelines Bugfix 🐛 PRs that fix a bug and removed Trivial The change is a trivial bug fix, documentation or maintenance change, as per the Git Guidelines labels Apr 6, 2022
@rubenwardy
Copy link
Member

rubenwardy commented Apr 7, 2022

No mods or games use the return value of set_local_animation. (Character Anim returns it but then ignores that)

The other functions return the last argument, assuming it isn't popped in the method

@rubenwardy
Copy link
Member

I found invalid 0 uses of the return value when looking through the search results for player:set_

This doesn't match all uses, but is enough for me to be sufficiently confident that the impact will be minimal

@appgurueu
Copy link
Contributor Author

Character Anim returns it but then ignores that

Yeah, that's a tail call. Probably not really needed though.

@rubenwardy
Copy link
Member

LGTM now

@sfan5 sfan5 merged commit 1f27bf6 into minetest:master Apr 10, 2022
@appgurueu appgurueu deleted the remove-setter-return branch March 31, 2024 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unneeded setters return
3 participants