lua-users home
lua-l archive

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

On Mon, Oct 24, 2022 at 3:45 PM bil til <> wrote:
This sizeof(TValue) number sounds odd to me for  Lua32 - are you
really sure about this?

I think these 12 byte (8+4) should be the size for Lua64? (8byte for a
64bit value, e. g. double float or 64 pointer, and 4 byte for the type
info in Lua 5.1 times?)

(for Lua32 I would expect sizeof(TValue)= 4+4= 8 in Lua 5.1 times?)

Even in 32-bit, the value part of a TValue is still 8 bytes because it can be a double float. In fact, compiling as 32-bit vs 64-bit only changes the size of pointers (and by extension the amount of memory that can be addressed). For numerical values, Lua still uses double floats and (in Lua 5.3+) 64-bit integers by default either way.