Skript icon indicating copy to clipboard operation
Skript copied to clipboard

Number Formatting

Open CerialPvP opened this issue 1 year ago • 4 comments

Suggestion

Basically, make it so you can specify numbers with underscores. Example: set {_n} to 10_000, give player 1_024 of barrier

Why?

  1. Most programming languages, such as Python and Java, already have this feature.
  2. For big numbers, it is a pain to write them out and count the length to make sure the number is correct and that we didn't enter a high number.

Other

No response

Agreement

  • [x] I have read the guidelines above and affirm I am following them with this suggestion.

CerialPvP avatar Aug 30 '24 19:08 CerialPvP

I think we should prefer commas if possible, e.g. give player 1,024 of barrier. This would break some existing list parsing, e.g. set {_list::*} to 1,100, but that is already confusing code imo

APickledWalrus avatar Aug 30 '24 21:08 APickledWalrus

I think that's pretty dangerous, especially with things like functions. It's very common to write location(1,104,188.3) for example

sovdeeth avatar Aug 30 '24 21:08 sovdeeth

yeah that's fair. it's probably more common than i'm thinking

APickledWalrus avatar Aug 30 '24 21:08 APickledWalrus

Also note some European countries use comma to denote decimals (where, for example, the US uses the '.'), adding more to the confusion.

I think this is a no-brainer. Super easy to add and does a lot for readability (the version with the underscore of course).

Mwexim avatar Sep 01 '24 07:09 Mwexim