Posted 18 December 2012 - 11:23 PM
I've been trying to convert strings of characters [0-9A-Fa-f_], each to either a decimal number or false if NaN.
The expression tonumber("_", 16) or false returns 8, however.
I've tested this on the integrated server - in my script as well as in the built-in interactive interpreter to eliminate the possibility of side effects. I also tested this quirk in an external interpreter for lua 5.1.4, where the result was - as expected - false. However, I'm not sure if that means that this behaviour is indeed related to CC nor do I know if it's a bug or actually a feature I am unaware of.
To reproduce this behaviour, type tonumber("_", 16) in the interactive interpreter.
The expression tonumber("_", 16) or false returns 8, however.
I've tested this on the integrated server - in my script as well as in the built-in interactive interpreter to eliminate the possibility of side effects. I also tested this quirk in an external interpreter for lua 5.1.4, where the result was - as expected - false. However, I'm not sure if that means that this behaviour is indeed related to CC nor do I know if it's a bug or actually a feature I am unaware of.
To reproduce this behaviour, type tonumber("_", 16) in the interactive interpreter.