LuaPlus:如何将表推送到堆栈
LuaPlus: How to push a table to the stack?
我希望函数在被Lua脚本调用时返回一个(键值)表。因此,我必须将桌子推到堆栈上。
我知道如何将整数推送到堆栈:state->PushInteger(10)
我也知道它如何适用于字符串和其他数字,但是我将如何将表推到堆栈,此外,我什至如何从C++端创建它?
这个网站通常很好地解释了一切: http://wwhiz.com/LuaPlus/LuaPlus.html但我真的很难理解LuaPlus是如何工作的。所以在这种情况下,它并没有真正帮助我。:(
如果有人能在这里帮助我,那就太好了,我现在真的想这样做 3 天了.. :/
该页面的Pushing a LuaObject onto the Lua Stack
部分似乎是我认为的答案。
The cases where you would need to push a LuaObject onto the Lua stack are rare. Nonetheless, the facility is provided through LuaObject's PushStack() function.
LuaObject tableObj(state);
tableObj.AssignNewTable();
tableObj.SetString("Key", "My String");
// It's often good practice to use a LuaAutoBlock here.
tableObj.PushStack(); // Be sure to clean it up when you're done!
相关文章:
- 算法问题:查找从堆栈中弹出的所有序列
- 使用模板进行堆栈实现; "name followed by :: must be a class or namespace"
- Visual Studio(或任何其他工具)能否将地址解释为调用堆栈(boost上下文)的开头
- 为什么调用堆栈数组会导致内存泄漏
- gdb错误:Backtrace已停止:上一帧与此帧相同(堆栈已损坏?)
- 在 leetcode 上提交解决方案时出现堆栈缓冲区溢出错误
- 我的 int main() 中出现堆栈溢出错误
- 堆栈和队列是否像C++中的数组一样传递?
- 拥有映射的现代方法,该映射可以指向或引用已在堆栈上分配的不同类型的数据
- 为什么 STL 容器适配器堆栈中的 top 返回常量引用?
- 从堆栈分配的原始指针构造智能指针
- 在函数范围内在堆栈上分配的数组在离开函数时是否总是被释放?
- 堆栈中大小变量输入错误 (C++)
- 堆栈问题(平衡表达式问题集)
- C++ 在堆栈中包含多态属性的类对象存储
- 用于解析 win64 堆栈跟踪的命令行客户端(可以访问符号服务器)
- 在 C++ 中使用链表进行堆栈
- 变量周围的堆栈'...'已损坏
- 在 gtest 中初始化堆栈上的引用变量的隔离错误
- LuaPlus:如何将表推送到堆栈