Add greater than and less than comparison operators for UDim

Create issue
Issue #342 resolved
Paul Turner created an issue

It's probably reasonable to assume that these operators will exist. We'll have to additionally assume that when using them the user understands the implications as far as the comparison assuming a common 'base'. This is already the case with the equality operators anyway.

See: http://www.cegui.org.uk/phpBB2/viewtopic.php?f=10&t=4720

Reproducibility: N/A

Comments (1)

  1. Paul Turner reporter

    The issue here is that without a base to use for the scale components we can't know what the scale part represents. For example:

    UDim a(0.5f, 0); UDim b(0, 200);

    is 'a' < 'b'?

    Without knowing what the base for the scale part is (i.e what it's 0.5 of), we can't determine this. If the base were to be 100, then 'b' is greater than 'a', if the base is 500, then 'a' is greater than 'b'.

    I think this is probably why I did not add these operators originally, and is why I'm still not going to be adding them now - it can't be done unless we pass the base value as an additional argument - which we can't do with operator< and operator>, so may as well use the existing approach of converting to a common form first, then comparing.

  2. Log in to comment