Can't convert string binary literals to numbers

Recently Roblox introduced binary literals so we could write numbers in binary like so: 0b1
But they forgot to add support for parsing the format with tonumber and implicit conversions:
assert(tonumber'0b1'==1) and '0b1'+0 both error
The counterparts for hexadecimal numbers, however, do not error:
assert(tonumber'0x1'==1) and '0x1'+0

Digit separated (1_0) numbers don’t appear to have the tonumber and implicit conversion support either

6 Likes

Seems like this should be a feature request rather than a bug report. I don’t think they have specifically worked on implementing this behavior, so it is missing functionality, not a bug.

Most likely not a bug.

If you need/want this, this should be a feature request.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.