X Tutup
Skip to content

Add support for bool and Vector in @GlobalScope.min() and .max()#117240

Open
EdwardChanCH wants to merge 2 commits intogodotengine:masterfrom
EdwardChanCH:fix_globalscope_min_max_bool
Open

Add support for bool and Vector in @GlobalScope.min() and .max()#117240
EdwardChanCH wants to merge 2 commits intogodotengine:masterfrom
EdwardChanCH:fix_globalscope_min_max_bool

Conversation

@EdwardChanCH
Copy link
Contributor

@EdwardChanCH EdwardChanCH requested a review from a team as a code owner March 9, 2026 07:28
@EdwardChanCH EdwardChanCH changed the title Fixed GlobalScope.min() and .max() not accepting bool Fix GlobalScope.min() and .max() not accepting bool Mar 9, 2026
@EdwardChanCH
Copy link
Contributor Author

EdwardChanCH commented Mar 9, 2026

Not sure if I should change the error message here or in a separate PR.
Might also want to add a note in the GDScript Reference for using min() max() to avoid short-circuiting.

@AThousandShips AThousandShips changed the title Fix GlobalScope.min() and .max() not accepting bool Add support for bool in GlobalScope.min() and .max() Mar 9, 2026
@AThousandShips AThousandShips added this to the 4.x milestone Mar 9, 2026
@Ivorforce Ivorforce requested a review from a team March 9, 2026 09:02
@AThousandShips
Copy link
Member

AThousandShips commented Mar 9, 2026

Note that the documentation needs to be updated as well to mention bool, and probably change the wording of "numerical values", assuming this is approved

@EdwardChanCH
Copy link
Contributor Author

EdwardChanCH commented Mar 9, 2026

Now that you mentioned it, the Godot Doc implies that @GlobalScope.min() will work on Vector types, when in fact it only accepts int and float types:
https://docs.godotengine.org/en/4.6/classes/class_%40globalscope.html#class-globalscope-method-min

Edit: I updated the docs and code to also accept Vector types, so that it becomes consistent with Array.min(). The first commit is kept for comparison.

@EdwardChanCH EdwardChanCH changed the title Add support for bool in GlobalScope.min() and .max() Add support for bool and Vector in @GlobalScope.min() and .max() Mar 9, 2026
@EdwardChanCH EdwardChanCH requested a review from a team as a code owner March 9, 2026 19:08
@EdwardChanCH EdwardChanCH force-pushed the fix_globalscope_min_max_bool branch from 986e73e to 19330f7 Compare March 9, 2026 19:14
@EdwardChanCH EdwardChanCH force-pushed the fix_globalscope_min_max_bool branch from 19330f7 to 74eeef4 Compare March 9, 2026 19:40
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.

Add all and any methods to @GlobalScope

2 participants

X Tutup