lua-users home
lua-l archive

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


On Wed, Jul 8, 2009 at 1:15 PM, Phoenix Sol<phoenix@burninglabs.com> wrote:
> K; Sounds like good advice; thanks, Sam.
>
> To answer your questions re manipulating these timestamps, though:
> I don't think they require much (or any) manipulation.
>
> This is probably overkill, but here are the prototypes I am looking at:

Judging from those APIs, something that might work is that for
returning uint64, return a lua_Number if it can fit without loss of
precision, otherwise a string.

So, you'd have to be a bit careful when calling tcrdbsize(), it could
return a number or a string. If you really want a number, you would
have to call tonumber() on the return value, which will work, it'll
just get converted to a large floating point number, and a bit of
precision will be lost.

For uint64 arguments, do the opposite, if it's already a number, use
it. If its a string, call strtoull().

Just a thought.

Cheers,
Sam