Can a compiled Lua file (32bit *.luac file) work on a 64 Bit system?
To quote the luac man page:
The binary files created by luac are portable only among architectures with the same word size and byte order.
So the answer is no. (I've also tested this exact situation with a 32-bit and a 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 Lua would accept it then.
I lack the experience to back up my words, but I believe that as long as the 32-bit lua binary is used to run that compiled file, it should work. Or rather, a binary built with similar settings, given the fact Lua offers a fair few compiler options that would affect the output of .luac
files and their internal structure.
In general, the rule is not to mix usage of lua executables with .luac
files created by another lua executable, as the inner format is highly dependant on the way Lua binaries themselves are compiled.
So if you run it with the 32-bit Lua you created the .luac files with, the answer is yes. If you were to run it with a 64-bit Lua executable, it would be a pretty definite no.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With