Cmdr
Cmdr copied to clipboard
More number types
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
.
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?
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 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"...
Those are Prefixed Union Types. Actual union types might be too complex to support in this version of Cmdr.
Maybe negative
, not_negative
(positive and 0), and positive
and not_positive
(negative and 0)?