lua-users home
lua-l archive

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


> A partial solution is to append "or nil" to the argument of every
> risky tostring() call, but it would be more elegant if it were handled
> at the language level.

Also, "false" would be transformed to "nil":

Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> =tostring( false or nil )
nil


Perhaps an extra parenthesis would work best:

Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> a=function()end
> =tostring( (a()) )
nil
>

--rb