lua-users home
lua-l archive

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


The documentation for tonumber in work2 [1] has not changed from 5.2[1]
in respects to when there is a base.
"When called with base, then e should be a string to be interpreted as
an integer numeral in that base."
For work2 this should have stated "must" instead of "should"


Lua 5.3.0 (work2)  Copyright (C) 1994-2014 Lua.org, PUC-Rio
> return tonumber(20,16)
stdin:1: bad argument #1 to 'tonumber' (string expected, got number)
stack traceback:
	[C]: in function 'tonumber'
	stdin:1: in main chunk
	[C]: in ?
> return tonumber(tostring(20),16)
32


[1] http://www.lua.org/work/doc/manual.html#pdf-tonumber
[2] http://www.lua.org/manual/5.2/manual.html#pdf-tonumber
-- 
Liam

Attachment: signature.asc
Description: OpenPGP digital signature