lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Peter Hill:
> The official format for numbers should be specified. It appears to be:
>     number ::= digit {digit} ['.' {digit}] [('e' | 'E') [-] digit {digit}]

Whoops. Make that:
    number ::= ('.' digit {digit} | digit ['.' {digit}]) [('e' | 'E') ['-'
    | '+'] digit {digit}]

I missed ".5" and "1e+4".

Eero Pajarre:
> I guess the answer here is "what system strtod supports", unless
> lua_str2number has been defined by the person compiling Lua. (This of
> course could/should be documented)

Huh? I'm talking about the code syntax, ie number constants, which as far as
I can tell are defined explicitly by "read_numeral()" in  "llex.c".

I guess the internal string-to-number functions may use a different syntax,
but that seems rather sad :-(. I'd hope that Lua libraries would check for
valid Lua number syntax before passing a string to "strtod".

Peter Hill.