lua-users home
lua-l archive

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

Hello List,

according to Lua-5.2 doc we have

  typedef ptrdiff_t lua_Integer;

On my x86_64-linux-gnu system, this is an 8 byte/64 bit integer.

I need to handle such 64 bit integers that appear as specific IDs.
The numerical value is less interesting than being able to reproduce
the bits identifying an object.

Trying the number

   2^63 - 123456789 == 9223372036731319019

$ lua
Lua 5.2.1  Copyright (C) 1994-2012, PUC-Rio
> i=9223372036731319019
> print(i)
> print(string.format("%d", i))

The variable i's value is off by 277 from what I stored there...

Given the new data type lua_Integer, I was hoping that I could
store and retrieve pristinely 64 bit quantities in Lua-5.2.

Is there any obvious way to do that which I'm missing?

Thanks, Dirk