Lua 5.2重定向打印功能
Lua 5.2 redirecting the print function
可能重复:
重定向/重新定义嵌入式Lua 的打印()
我是卢阿的新手,相当困惑。我看过这个,但我不确定它是否适用于5.2。
我读过_ENV表(?),但再次不确定这是否与它有关。
那么问题来了:在C/C++中,我如何重定向Lua 5.2的内置打印函数来调用我自己的C/C++函数?
来自Lua 5.2手册:
Lua keeps a distinguished environment called the global environment.
This value is kept at a special index in the C registry (see §4.5).
In Lua, the variable _G is initialized with this same value.
因此,如果您将对luaL_register
的调用替换为对luaL_setfuncs
的调用,那么您链接的问题的答案将有效。
相关文章:
- 打印功能无法正常工作 - 链表
- 阵列打印功能
- 为什么我的打印功能不起作用?链表
- 为什么我的打印功能之一删除节点
- 打印功能不会终止
- 如何正确格式化此打印功能
- 使用for_each从对象列表中调用打印功能
- 打印功能的地址..声明
- 作为参数传递的打印功能指针导致屏幕上打印"1"
- 无效打印功能错误
- 尽管具有打印功能,但我的矢量无法打印
- 我在双链表上的此打印功能时遇到问题
- 二进制树级别明智的打印功能不起作用
- 需要使班级(long_number)用构造函数和一个打印功能代表1到60的任何长度
- 我的链接列表打印功能进入无限循环
- 一个人可以使用clang ast使用名称打印功能指针的质量
- 如何实现打印功能
- 如何禁用打印功能
- 一个奇怪的打印功能错误
- 为什么我的打印功能为我的Postfix程序产生此错误