在 Ubuntu 上将 IUP 与 Lua 结合使用

发布于 2024-10-12 13:18:12 字数 591 浏览 2 评论 0原文

我正在尝试让 IUP 在 Ubuntu 上运行。我从 sourceforge 下载了二进制文件,这些库似乎位于 /usr/lib/libiup*.so 中,但是当我编写如下脚本时:

require("iuplua")
iup.Message('Testing App!', 'Finished Successfully!')

我收到一个错误:

lua: attempt to call a nil value
stack traceback:
    [C]: ?
    [C]: in function 'require'
    test.lua:1: in main chunk
    [C]: ?

查看它,我看到一条消息指出有人似乎已经修复了它 - 他们的“LD_LIBRARY_PATH 没有指向正确的 cd 和 im 目录”或类似的东西。我似乎无法使用 LD_LIBRARY_PATH 环境变量来纠正我的问题。我看到 2008 年的另一篇注释说“IUPLua 二进制文件对 lua 字节码进行了硬编码,导致了错误”。我尝试从源代码进行编译,但出现与 cd.h 相关的错误。

任何帮助将非常感激。谢谢!

I'm trying to get IUP working on Ubuntu. I downloaded the binaries from sourceforge and the libraries seem to be in place in /usr/lib/libiup*.so, but when I write a script like the following:

require("iuplua")
iup.Message('Testing App!', 'Finished Successfully!')

I get an error:

lua: attempt to call a nil value
stack traceback:
    [C]: ?
    [C]: in function 'require'
    test.lua:1: in main chunk
    [C]: ?

Looking into it, I saw a message noting that someone seemed to have fixed it - their "LD_LIBRARY_PATH did not point to the right cd and im directories" or something similar. I couldn't seem to correct my problem w the LD_LIBRARY_PATH environment variable. I saw another note from 2008 saying that the "IUPLua binaries have hardcoded lua bytecode that is causing the error". I tried to compile from the sources, but I'm getting errors related to cd.h.

Any help would be -greatly- appreciated. Thanks!

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

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

发布评论

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

评论(1

无远思近则忧 2024-10-19 13:18:12

您可以查看以下内容,也许会有帮助。

当您使用 require 加载模块时,Lua 使用包路径来确定在哪里查找该模块。

package.path:Lua 查找 .lua 模块的位置
package.cpath:Lua寻找.so/.dll模块的地方

查看 Lua 手册的这一部分: 模块。具体来说,是关于 package.pathpackage.cpath 的部分。

您可以检查当前路径是什么样的:

print(package.path.."\n"..package.cpath)

您可以附加路径,例如:

package.path = package.path..";/usr/lib/?.lua"
package.cpath = package.cpath..";/usr/lib/?.so"

Here is something you can check out, perhaps it will help.

When you load a module with require Lua uses the package paths to determine where to look for the module.

package.path: Where Lua looks for .lua modules
package.cpath: Where Lua looks for .so/.dll modules

Have a look at this section of the Lua manual: Modules. Specifically, the section on package.path and package.cpath.

You can check what the current paths are like:

print(package.path.."\n"..package.cpath)

You can append the paths like:

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