[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Using numbers as float
- From: Sam Roberts <sroberts@...>
- Date: Fri, 30 Jun 2006 09:57:50 -0700
On Fri, Jun 30, 2006 at 10:54:01AM -0300, Roberto Ierusalimschy wrote:
> > [BTW: Whatever Lua 5.2 or 6.0 may look like, but may I suggest
> > redesigning or at least renaming the auto-coercive API calls?]
> Only lua_tostring does auto-coercion. lua_tonumber (and lua_isnumber)
> does not modify the original object (at the cost of performing the
> conversion at every new call).
I lost a number of hours trying to get a table coercion working, I had
I knew lua_tostring() would coerce the type of the value on the stack,
but it never occurred to me that lua_isstring() would return true if
it is NOT a string.
I guess this is just a gotcha for new lua users, and now that I know I
don't mind so much, but it sure surprised me.