used the min(maxVal, max(minVal, x)) trick to clamp these gauge values :^)

Follow

i feel like it's really ugly but i mean it's simple, it works, it's just not super obvious what it's doing

oh well

@mdszy Put it in a function? Then the ugliness is hidden and your code makes more sense upfront.

@OTheB this is in a little expression language without functions, otherwise that's a great idea

@OTheB in this context, it's not a fully fledged program where I'm doing this

In the software it's a little input where you can use expressions to do rudimentary operations on strings and numbers, all self contained and very basic, so no functions in this context

Elsewhere the software just uses straight python but yeah

Sign in to participate in the conversation
Mastodon for Tech Folks

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!