• <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 函数

        时间:2023-09-27
        • <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 函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何使用可变参数模板制作通用的 Lua 函数包装器? 下一篇:“未定义的引用"使用 Lua

                  相关文章

                    <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>