lua-users home
lua-l archive

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


> Just out of curiosity, how complex would it be to write a converter from 
> compiled bytecode where LUA_NUMBER is double to compiled bytecode where 
> LUA_NUMBER is int?

Just to be clear, if the sizes of double and the endianness in both
platforms match, then this should work:

static lua_Number LoadNumber(LoadState* S)
{
 double x;
 LoadVar(S,x);
 return (lua_Number) x;
}

But you still need to change LoadHeader to skip some bytes:

 IF (memcmp(h,s,LUAC_HEADERSIZE-2)!=0, "bad header");