-
Notifications
You must be signed in to change notification settings - Fork 69
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
Add isEmpty
function to Module:Opponent
#3258
Add isEmpty
function to Module:Opponent
#3258
Conversation
Mind splitting into 2 PRs? The bye is completely fine for instance merge, but wanna think through the empty one a bit. |
|
isEmpty
and isBye
functions to Module:Opponent
isEmpty
function to Module:Opponent
for the isEmpty one as an alternative option that might be better: ---Checks if an opponent is empty
---@param opponent standardOpponent?
---@return boolean
function Opponent.isEmpty(opponent)
return not opponent or not opponent.type
or (String.isEmpty(opponent.name) and String.isEmpty(opponent.template) and Table.isEmpty(opponent.players))
or (not Opponent.isTbd(opponent) and Table.deepEquals(opponent, Opponent.blank(opponent.type)))
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add some comments (why comments) for the two cases?
Like TBD Team Opponents are not considered empty
Co-authored-by: Martin B <[email protected]>
depends on #3285
Summary
Add
isEmpty
function toModule:Opponent
Idea is to have an easy function for checking against this case sicne we might find it useful in several modules
How did you test this change?
not tested, new functions so can not break stuff and logic is pretty simple
did not set up testcases for opponent module since it would have to (imo) include lots more test cases and i would rather add that via a sep pr at a later time