将 Lua 嵌入 C++

2021-12-30 00:00:00 cross-platform lua c++

我想编写一个可以在执行过程中交互/调用 Lua 脚本的 C++ 程序.该程序的一个关键概念是完全独立于平台,但我似乎无法找到实际提供某些东西的 Lua 构建.

I want to write a C++-Program that can interact/call Lua-scripts during execution. A key concept of the program is complete platform independence, but I seem to be unable to locate a Lua-build that actually offers something that.

到目前为止,我发现的 Lua 构建要么基于环境变量,要么基于特定的库,例如 .lib.dll.so.来自 lua.org 的官方 Lua 源也不是我正在寻找的,因为它定义了一个主要的 -功能...

The Lua-builds I found so far are either based on environment-variables or specific libraries like .lib, .dll or .so. The official Lua-source from lua.org also is not what I'm looking for as it defines a main-function…

是否有一个简单的 - 最好的情况是像 sqlite-amlgamation - Lua-interpreter for C/C++ 没有任何这些依赖项?

Is there a simple - best case would be something like sqlite-amalgamation - Lua-interpreter for C/C++ that doesn't have any of these dependencies?

推荐答案

lua.c 包含 main 并定义了控制台应用程序的入口点.如果您将其从项目中删除,剩下的会构建到独立库中,或者您愿意的话,可以构建动态库.

lua.c contains main and defines the entry point for a console application. If you remove it from the project, whats left builds into a standalone lib, or dynamic library if you prefer, just fine.

相关文章