• <tfoot id='0cIq6'></tfoot>
    • <bdo id='0cIq6'></bdo><ul id='0cIq6'></ul>
    <legend id='0cIq6'><style id='0cIq6'><dir id='0cIq6'><q id='0cIq6'></q></dir></style></legend>

    <small id='0cIq6'></small><noframes id='0cIq6'>

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

        在 C/C++ 中引用 Lua 函数

        Reference to Lua function in C/C++(在 C/C++ 中引用 Lua 函数)
        • <bdo id='TPn88'></bdo><ul id='TPn88'></ul>
          <legend id='TPn88'><style id='TPn88'><dir id='TPn88'><q id='TPn88'></q></dir></style></legend>

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

              1. <small id='TPn88'></small><noframes id='TPn88'>

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

                  问题描述

                  我有一个函数嵌套在一组表中相对较深.C/C++ 中有没有办法在我需要使用它时获得对该函数的引用"并将其(和参数)推入堆栈?

                  I have a functions nested relatively deeply in a set of tables. Is there a way in C/C++ to get a "reference" to that function and push that (and args) onto the stack when I need to use it?

                  推荐答案

                  这就是 参考系统是为了.函数调用 r = luaL_ref(L, LUA_REGISTRYINDEX) 将值存储在注册表中的栈顶并返回一个整数,该整数可以存储在 C 端并用于检索该值函数调用lua_rawgeti(L, LUA_REGISTRYINDEX, r).

                  This is what the reference system is for. The function call r = luaL_ref(L, LUA_REGISTRYINDEX) stores the value on the top of the stack in the registry and returns an integer that can be stored on the C side and used to retrieve the value with the function call lua_rawgeti(L, LUA_REGISTRYINDEX, r).

                  请参阅PiL 章节,以及luaL_ref(), lua_rawgeti()luaL_unref() 了解完整故事.

                  See the PiL chapter, as well as the documentation of luaL_ref(), lua_rawgeti(), and luaL_unref() for the full story.

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

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Constructor initialization Vs assignment(构造函数初始化 Vs 赋值)
                  Is a `=default` move constructor equivalent to a member-wise move constructor?(`=default` 移动构造函数是否等同于成员移动构造函数?)
                  Has the new C++11 member initialization feature at declaration made initialization lists obsolete?(声明时新的 C++11 成员初始化功能是否使初始化列表过时了?)
                  Order of constructor call in virtual inheritance(虚继承中构造函数调用的顺序)
                  How to use sfinae for selecting constructors?(如何使用 sfinae 选择构造函数?)
                  Initializing a union with a non-trivial constructor(使用非平凡的构造函数初始化联合)

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

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

                          <legend id='wiLG7'><style id='wiLG7'><dir id='wiLG7'><q id='wiLG7'></q></dir></style></legend>
                            <tbody id='wiLG7'></tbody>