lua-users home
lua-l archive

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


I've been tinkering with ways to figure out a way to determine
endianness of a system dynamically in pure lua.  This is what I came up,
which is based on the bytecode format as documented with the below,
which depends on examining the bytecode:

function endian()
        local function f() end
        return string.byte(string.dump(f),7)
end

print(endian())


I'm not happy with checking the header - is there something a bit less
magic?

Thanks in advance


-- 
Jim Mellander
Incident Response Manager
Computer Protection Program
Lawrence Berkeley National Laboratory
(510) 486-7204

The reason you are having computer problems is:

The mouse escaped.