Cmdr icon indicating copy to clipboard operation
Cmdr copied to clipboard

More number types

Open evaera opened this issue 6 years ago • 5 comments

natural, which would be a subset of the current integer type, would allow numbers in the range 0..n. positive, which would be a subset of natural, would allow the range 1..n

byte, which would allow the range 0..255. digit, which would allow the range 0..9.

evaera avatar Feb 17 '19 07:02 evaera

What about negative (n..-1), zero (0, not to be used on its own), and positive (1..n) types?

Possibly a generic range type as well?

LoganDark avatar Feb 17 '19 07:02 LoganDark

What's the use case for zero? And if you're only going to allow negative, I think you might as well just use positive and then negate it in the command.

Generic types would be nice but are currently an unsupported feature. #50 could provide a means for a developer to implement generic-like arguments, though.

evaera avatar Feb 17 '19 07:02 evaera

@evaera Can't you combine types? I think I've seen it in the teleport command, although I suspect the @ just says "if you see an @ just use this other type"...

LoganDark avatar Feb 17 '19 07:02 LoganDark

Those are Prefixed Union Types. Actual union types might be too complex to support in this version of Cmdr.

evaera avatar Feb 17 '19 07:02 evaera

Maybe negative, not_negative (positive and 0), and positive and not_positive (negative and 0)?

LoganDark avatar Feb 18 '19 03:02 LoganDark