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

refactor: replace nil checks with not in conditions #4578

Merged
merged 5 commits into from
Dec 4, 2023
Merged

refactor: replace nil checks with not in conditions #4578

merged 5 commits into from
Dec 4, 2023

Conversation

omarcopires
Copy link
Contributor

@omarcopires omarcopires commented Dec 1, 2023

Pull Request Prelude

Changes Proposed

This commit introduces a refactor to replace nil checks with the use of not in logical conditions, aligning with the preferred style in the codebase. This change improves code readability and consistency throughout the affected sections.

@Zbizu
Copy link
Contributor

Zbizu commented Dec 2, 2023

this change introduces nil comparisons which tfs moved away from, except for situations when both nil and false can be returned by a function and need to be distinguished

if the statement does not need to distinguish between false and nil:

  • ~= nil is not necessary in logical statements
  • if x == nil then should be replaced with if not x then

by the way, can storage checks return nil now?

@MillhioreBT
Copy link
Contributor

What @Zbizu says is true, please make the change from if not x then
and for cases of setStorageValue(-1), change to removeStorageValue

@omarcopires omarcopires changed the title refactor: replace -1 with nil refactor: replace nil checks with not in conditions Dec 4, 2023
@luanluciano93
Copy link
Contributor

luanluciano93 commented Dec 4, 2023

Every time I pull a value from storage, will I have to check to see if it is not null? There is no logic in changing this.

Copy link
Contributor

@MillhioreBT MillhioreBT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change what you check on line 16 in login.lua

@MillhioreBT MillhioreBT merged commit ad6a00d into otland:master Dec 4, 2023
4 checks passed
@omarcopires omarcopires deleted the replace-nil branch December 4, 2023 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants