<tfoot id='UhbQo'></tfoot>
    • <bdo id='UhbQo'></bdo><ul id='UhbQo'></ul>
  1. <small id='UhbQo'></small><noframes id='UhbQo'>

    1. <i id='UhbQo'><tr id='UhbQo'><dt id='UhbQo'><q id='UhbQo'><span id='UhbQo'><b id='UhbQo'><form id='UhbQo'><ins id='UhbQo'></ins><ul id='UhbQo'></ul><sub id='UhbQo'></sub></form><legend id='UhbQo'></legend><bdo id='UhbQo'><pre id='UhbQo'><center id='UhbQo'></center></pre></bdo></b><th id='UhbQo'></th></span></q></dt></tr></i><div id='UhbQo'><tfoot id='UhbQo'></tfoot><dl id='UhbQo'><fieldset id='UhbQo'></fieldset></dl></div>

      <legend id='UhbQo'><style id='UhbQo'><dir id='UhbQo'><q id='UhbQo'></q></dir></style></legend>

      在 C++ 中嵌入 Lua

      时间:2023-09-27

      • <small id='elzj7'></small><noframes id='elzj7'>

            <bdo id='elzj7'></bdo><ul id='elzj7'></ul>
            • <tfoot id='elzj7'></tfoot>
              <i id='elzj7'><tr id='elzj7'><dt id='elzj7'><q id='elzj7'><span id='elzj7'><b id='elzj7'><form id='elzj7'><ins id='elzj7'></ins><ul id='elzj7'></ul><sub id='elzj7'></sub></form><legend id='elzj7'></legend><bdo id='elzj7'><pre id='elzj7'><center id='elzj7'></center></pre></bdo></b><th id='elzj7'></th></span></q></dt></tr></i><div id='elzj7'><tfoot id='elzj7'></tfoot><dl id='elzj7'><fieldset id='elzj7'></fieldset></dl></div>

                <tbody id='elzj7'></tbody>
              1. <legend id='elzj7'><style id='elzj7'><dir id='elzj7'><q id='elzj7'></q></dir></style></legend>

                本文介绍了在 C++ 中嵌入 Lua的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我一直在尝试将 lua 嵌入到 C++ 应用程序中,但无济于事,因为编译器抱怨lua_open".我使用的是 Lua 5.2.

                I've been trying to embed lua in a c++ application but to no avail since the compiler complains about "lua_open".I'm using Lua 5.2.

                我发现很多文章声称 lua_open() 在第五版中被替换了,但没有一个提到什么.

                I found alot of articles claiming that lua_open() was replaced in the fifth version but none of them mentioned with what.

                这是我要编译的代码

                extern "C" {
                #include "../lua/lua.h"
                #include "../lua/lualib.h"
                #include "../lua/lauxlib.h"
                }
                
                int main()
                {
                    int s=0;
                
                    lua_State *L = lua_open();
                    // load the libs
                    luaL_openlibs(L);
                    luaL_dofile(L,"example.lua");
                    printf("
                Done!
                ");
                    lua_close(L);
                
                    return 0;
                }
                

                推荐答案

                确实,lua_open函数/5.2/manual.html#4" rel="noreferrer">lua 5.2 参考手册

                Indeed, the lua_open function is not mentioned in the lua 5.2 reference manual

                一个lua_State是用lua_newstate构造的,你可以使用lauxlib.h中的luaL_newstate

                A lua_State is constructed with lua_newstate, and you can use luaL_newstate from lauxlib.h

                获得此类问题答案的更快方法是查看 Lua 5.2 源代码(我刚刚做了).

                A faster way to get the answers to such question is to look into the Lua 5.2 source code (which I just did).

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

                上一篇:使用直接 Lua,如何公开现有的 C++ 类对象以在 Lua 脚本中使用? 下一篇:使用唯一的动态变量名(不是变量值!)

                相关文章

                    <bdo id='s482D'></bdo><ul id='s482D'></ul>
                1. <legend id='s482D'><style id='s482D'><dir id='s482D'><q id='s482D'></q></dir></style></legend>

                    <small id='s482D'></small><noframes id='s482D'>

                    <tfoot id='s482D'></tfoot>
                  1. <i id='s482D'><tr id='s482D'><dt id='s482D'><q id='s482D'><span id='s482D'><b id='s482D'><form id='s482D'><ins id='s482D'></ins><ul id='s482D'></ul><sub id='s482D'></sub></form><legend id='s482D'></legend><bdo id='s482D'><pre id='s482D'><center id='s482D'></center></pre></bdo></b><th id='s482D'></th></span></q></dt></tr></i><div id='s482D'><tfoot id='s482D'></tfoot><dl id='s482D'><fieldset id='s482D'></fieldset></dl></div>