32位Lua字节码可以在64位系统上运行吗?

发布于 2024-09-27 00:27:02 字数 42 浏览 0 评论 0原文

编译好的Lua文件(32位*.luac文件)可以在64位系统上运行吗?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

风和你 2024-10-04 00:27:02

引用 luac 手册页

由 luac 创建的二进制文件只能在具有相同字长和字节顺序的体系结构之间移植。

所以答案是否定的。 (我还在 32 位和 64 位机器上测试了这种确切情况。)您可以做的一件事是确保您的 Lua 解释器是针对 32 位编译的(即使在 64 位机器上),并且我相信Lua会接受的。

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.

萌酱 2024-10-04 00:27:02

我缺乏经验来支持我的话,但我相信只要使用 32 位 lua 二进制文件来运行该编译文件,它就应该可以工作。或者更确切地说,使用类似设置构建的二进制文件,因为 Lua 提供了相当多的编译器选项,这些选项会影响 .luac 文件的输出及其内部结构。

一般来说,规则是不要将 lua 可执行文件与另一个 lua 可执行文件创建的 .luac 文件混合使用,因为内部格式高度依赖于 Lua 二进制文件本身的编译方式。

因此,如果您使用创建 .luac 文件的 32 位 Lua 运行它,答案是肯定的。如果您要使用 64 位 Lua 可执行文件来运行它,那肯定是不行的。

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.

原谅过去的我 2024-10-04 00:27:02

https://github.com/c0i/lua32

仅在所有 32/64 上使用 32 位字节码位系统。

https://github.com/c0i/lua32

just use 32-bit bytecode on all 32/64 Bit system.

不疑不惑不回忆 2024-10-04 00:27:02

你没有说为什么要提供编译好的Lua文件(源代码可以更小,并且加载得很快)。无论如何,原始源的替代方案是 squish

You didn't say why you want to deliver compiled Lua files (source code can be smaller, and loads quite quickly). In any case, an alternative to raw source is squish.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文