Platform Detection |
|
io.popen
with commands like 'uname'
can help identify a system. See [LuaRocks cfg.lua] and [1].
string.dump
therefore can provide information such as endianness, sizeof(int)
, sizeof(size_t)
, sizeof(lua_Number)
, and whether floating point is supported. See [A No-Frills Introduction to the Lua 5.1 VM]. However, not all LuaImplementations implement the standard Lua bytecode format.
ffi.os
, ffi.arch
and ffi.abi()
.
Note: some things can be tricky like Cygwin, which is like a *nix emulator on Windows. For portability purposes, Cygwin is mainly considered *nix, but it has some Windows features.