Can Lua 32-bit bytecode work on a 64-bit system?

Can a compiled Lua file (32bit * .luac file) work on a 64-bit system?

+4
source share
3 answers

To quote the luac man page:

The binaries created by luac are portable only among architectures with the same word size and byte order.

So the answer is no. (I also checked this exact situation with a 32-bit and 64-bit machine.) One thing you can do is ensure that your Lua interpreter is compiled for 32-bit (even on a 64-bit machine) and I believe that Lua will agree to this.

+5
source

I don't have enough experience to back up my words, but I believe that as long as the 32-bit lua binary is used to run this compiled file, it should work. Rather, binary code built with similar settings, given the fact that Lua offers several compiler options that affect the output of .luac files and their internal structure.

In general, the rule is not to mix the use of lua executables with .luac files created by another lua executable, since the internal format depends heavily on how the Lua compilers themselves compile.

So, if you run it with 32-bit Lua, you have created .luac files, the answer is yes. If you were to run it using the 64-bit Lua executable, that would be pretty straightforward.

+2
source

You did not say why you want to deliver the compiled Lua files (the source code may be smaller and loads quite quickly). In any case, squish is an alternative to the original source.

0
source

All Articles