void luaU_header (char* h)
{
int x=1;
memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-1);
h+=sizeof(LUA_SIGNATURE)-1;
*h++=(char)LUAC_VERSION;
*h++=(char)LUAC_FORMAT;
*h++=(char)*(char*)&x;/* endianness */
*h++=(char)sizeof(int);
*h++=(char)sizeof(size_t);
*h++=(char)sizeof(Instruction);
*h++=(char)sizeof(lua_Number);
*h++=(char)(((lua_Number)0.5)==0);/* is lua_Number integral? */
}
You can see that it doesn't check for the endianness of lua_Number. Perhaps the next Lua release that breaks binary compatibility in compiled files should also include some sort of check for the endianness of lua_Number.
Maybe there needs to be a tool to convert compiled Lua files between different platforms.