lua-users home
lua-l archive

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


Hi,

I know that there are some mails commenting on this, but none gives a solution that applies to my case.

Right now I have an application that uses internally 64-bit long integers. I would like to modified such integers in a Lua script (obviously I have a Lua interpreter embedded).

The problem I see is that when trying to push a 64-bit integer, it gets truncated. The reason for this is that my luaconf.h has a define like:

#define LUA_INTEGER    ptrdiff_t

and ptrdiff_t as:

typedef _W64 int            ptrdiff_t;

so when using:

lua_pushinteger(m_pState, value);

the value must be a 32 int.

How should I modified the luaconf.h to support 64 bit, if I simply change de define to:

#define LUA_INTEGER    long long

Then several warning in code appear (free translation).

warning C4244: 'function' conversion from 'lua_Integer' tp 'ptrdiff_t'. possible data loss. src_lua51\lstrlib.c    46

Then which is the correct way to add 64-bit integers?

Best regards.
Javier Monge