mikke89 / RmlUi

RmlUi - The HTML/CSS User Interface library evolved
https://mikke89.github.io/RmlUiDoc/
MIT License
2.57k stars 295 forks source link

Support for Modulus operation in expressions #622

Closed YTN0 closed 2 weeks ago

YTN0 commented 2 weeks ago

Tried to do a modulus in an expression, and realized this isn't supported (via the error, and from looking at the docs).

Is there a reason this isn't currently supported?

mikke89 commented 2 weeks ago

The data expressions are by design very simple and minimal. Instead, you can extend them with the functionality you need using transform functions.

YTN0 commented 2 weeks ago

Thanks. That was easy enough to do.

One issue I ran into was assuming that the custom functions were specific to the current data model, but that doesn't seem to be the case I.e it's global to all.

I'm wondering if it makes sense to split that out into a separate class that makes that clearer.

I guess it doesn't really matter too much.

mikke89 commented 2 weeks ago

Glad to hear!

Yeah, that's good feedback, I agree the API could have been separated a bit better in this aspect. I'm not sure if it's worth changing right now though.