numbers in scarpet better handle long type values.

If possible, numbers that can be represented as longs (seeds, etc) will be handled as longs but they will loose their longinness with a single arithmetic operation.
This commit is contained in:
gnembon committed 2020-08-21 00:47:19 -03:00
1 parent bc9f3e89e0
commit 968ef0cd9f
8 files changed
+87 -24

No files matched your search

@@ -16,8 +16,11 @@ block positions. All variables starting with `_` are read-only, and cannot be de
## Literals
`scarpet` accepts numeric and string liters constants. Numbers look like `1, 2.5, -3e-7, 0xff,` and are internally
represented as Java's `double` but `scarpet` will try to trim trailing zeros as much as possible so if you need to
use them as intergers, you can. Strings use single quoting, for multiple reasons, but primarily to allow for
represented primarily as Java's `double` but `scarpet` will try to trim trailing zeros as much as possible so if you
need to use them as integers or even longs - you can. However any operation on a number even if it can be properly
represented as long, but not a double type, will make them round up to be doubles.
Strings use single quoting, for multiple reasons, but primarily to allow for
easier use of strings inside doubly quoted command arguments (when passing a script as a parameter of `/script fill`
for example), or when typing in jsons inside scarpet (to feed back into a `/data merge` command for example).
Strings also use backslashes `\` for quoting special characters, in both plain strings and regular expressions