Lua C PAI中的lua_dump
来源:互联网 发布:什么测试网络掉包 编辑:程序博客网 时间:2024/05/01 04:24
lua_dump官方文档说明
lua_dump
[-0, +0, e]
int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip);
Dumps a function as a binary chunk. Receives a Lua function on the top of the stack and produces a binary chunk that, if loaded again, results in a function equivalent to the one dumped. As it produces parts of the chunk, lua_dump
calls function writer
(see lua_Writer
) with the given data
to write them.
If strip
is true, the binary representation may not include all debug information about the function, to save space.
The value returned is the error code returned by the last call to the writer; 0 means no errors.
This function does not pop the Lua function from the stack.
下面是string扩展库中使用的例子
static int writer (lua_State *L, const void* b, size_t size, void* B) { (void)L; luaL_addlstring((luaL_Buffer*) B, (const char *)b, size); return 0;}static int str_dump (lua_State *L) { luaL_Buffer b; luaL_checktype(L, 1, LUA_TFUNCTION); lua_settop(L, 1); luaL_buffinit(L,&b); if (lua_dump(L, writer, &b) != 0) return luaL_error(L, "unable to dump given function"); luaL_pushresult(&b); return 1;}
0 0
- Lua C PAI中的lua_dump
- pai
- ABAP 中的Screen, Dynpro, PBO, PAI小结
- c语言输出pai的近似值
- C/C++读取Lua中的变量及调用Lua函数
- Lua学习笔记:Lua 中的C Api 概述
- C/C++读取Lua中的变量及调用Lua函数
- lua 在C文件中的调用方式
- C/C++ 如何调用Lua中的数据
- C/C++遍历Lua中的table
- C中的lua二维表遍历
- lua -->c c-->lua
- ABAP的PAI和PBO中的字段传递顺序
- ABAP的PAI和PBO中的字段传递顺序
- 求pai 在Microsoft Visual Studio 运行 c语言
- lua--lua中的表达式
- lua--lua中的迭代器
- Lua与C/C++的交互3:C/C++中读取Lua文件中的表
- 求二叉树两节点的最小父节点(有父节点指针)
- Hadoop系列之十:Hadoop配置文件及常用配置参数详解(未完成)
- 【bzoj3251】树上三角形
- 程序设计模式-“OPGA设计模式”简介
- 多线程和多进程
- Lua C PAI中的lua_dump
- HDU 5445 Food Problem 解题报告(背包)
- 编码问题
- 兔子--android:ems="3"是什么意思
- 对Java中类的定义,继承等的自我理解
- IMOOC_String
- SED 使用 介绍
- Linux进程
- 按两次返回键退出