Let the following code :
lua_pushinteger( m_pLuaState, 123 );
const char * sAsString = lua_tostring( m_pLuaState, -1 );
The returns non-NULL pointers to strings containing strange numeric values like "17137503626592379" or "14326121113845883" etc...
It seems random, does not violate memory (at least in a few tries), and the returned strings always contain valid numeric values despite not being the one I'm passing in the first place (i.e 123).
I assume this has to do with floating point / integer convertions.
I'm using Lua 5.3.2, which supports both "integer" and "float" as being two subtypes of "number", and i'm using floats for numbers and int for integers.
I'm using both Windows CE and Windows 7. On both platforms "int" and "float" are both 32 bits, despite my Windows 7 being 64 bits, because I'm explicitely compiling for x86.
Here is a piece of my luaconf.h
#if !defined(LUA_INT_TYPE)
#define LUA_INT_TYPE LUA_INT_INT
#endif
#if !defined(LUA_FLOAT_TYPE)
#define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT
#endif
While writing this I realized that it might be due to the fact that I changed the types being used without recompiling the static lua .lib that i'm linking against. Could this be due to this ? I will try recompiling...
Could this be due to something else ? Thank you.