将 Lua 嵌入 C++

Embed Lua into C++(将 Lua 嵌入 C++)

本文介绍了将 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.

这篇关于将 Lua 嵌入 C++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:将 Lua 嵌入 C++

基础教程推荐