lua编译需要错误
使用 srlua 将 lua 文件编译为独立程序(即 exe)后,出现大量错误。
以后总是找不到“require()”中的任何内容,并且程序将根本无法运行。
有没有办法解决这个问题,让程序正常运行?
谢谢。
I get tons of errors after I compile a lua file into a stand-alone program (i.e. exe) with srlua.
Always anything in the "require()" it cannot find later and the program will simply not run.
Is there a way to solve this and so the program will run properly?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您执行 require 时,默认方法会根据 lua.exe 的位置扫描目录。 srLua 似乎不处理依赖关系。也许你应该使用 Lua 内置程序 来代替。该项目似乎已被放弃,但它确实在 2010 年发布过,所以它大多是最近的。
When you execute
require
, the default methods scan directories based on the location oflua.exe
. srLua seems to not handle dependencies. Perhaps you should use Lua Built-In Program instead. The project seems to be abandoned, but it did have a release in 2010, so it's mostly recent.我最近使用 Squish 收集了一堆 Lua 模块和几个相关的模块,取得了很好的效果脚本放在一起,以便它们可以与其主机应用程序一起打包在单个 exe 中。
我确实必须进行一些调整才能在 Windows 中构建和使用它,但它们都是以 Unix 为中心的现有源代码套件的明显扩展或翻译。 Squish 本身是用纯 Lua 编写的,构建它时会将 smish 应用于自身,以生成一个独立的脚本文件,以便与普通 Lua 解释器一起使用。
除了处理依赖模块之外,它还可以编译和/或压缩代码以获得更小的输出。
如果您正在使用现有的 Lua 解释器,那么使用 Squish 获取单个文件并使用 srlua 将其与解释器打包可能是一个不错的组合。
I have had good results from using Squish recently to collect a bunch of Lua modules and several related scripts together so that they could be packaged in a single exe along with their host app.
I did have to make some tweaks to build and use it in Windows, but they were all obvious extensions or translations of the Unix-centric existing source kit. Squish itself is written in pure Lua, and building it applies squish to itself to generate a single self-contained script file for use with the normal Lua interpreter.
In addition to handling dependent modules, it can also compile and/or compress the code for even smaller output.
If you are working with the stock Lua interpreter, then using Squish to get a single file and srlua to package it with the interpreter is probably a good combination.