lua string.dump
来源:互联网 发布:00后直播软件 编辑:程序博客网 时间:2024/06/05 06:44
string.dump在lua manual 上的描述是:
string.dump (function [, strip])
Returns a string containing a binary representation (a binary chunk) of the given function, so that a later load
on this string returns a copy of the function (but with new upvalues). If strip
is a true value, the binary representation may not include all debug information about the function, to save space.
Functions with upvalues have only their number of upvalues saved. When (re)loaded, those upvalues receive fresh instances containing nil. (You can use the debug library to serialize and reload the upvalues of a function in a way adequate to your needs.)
返回一个字符串,该字符串包含一个函数的二进制描述,之后可以用load加载这个函数的拷贝。如果strip参数为true,那么函数拷贝为减少空间将不会包含任何调试信息。
函数只保存upvalues的数目。当重新加载时,所有的upvalue设置为nil。
举个简单的例子:
function test(n)print("test:",n)enda = string.dump(test, true);b = load(a);b(6) -->test:6可以看出函数能被当成参数进行传递!string.dump实现了函数的序列化,能在不同的作用域进行传递。
- lua string.dump
- lua dump
- lua——string库函数的用法例子(包括string.dump的用法例子)
- lua dump函数
- lua dump函数
- Lua stack dump for c++
- lua string
- Lua string
- lua string
- Lua String
- LUA string库详解
- lua--string库函数
- Lua的string库
- Lua string 处理
- Lua string库
- Lua的string操作
- LUA string库详解
- lua string 库
- 诸葛分享:一个失败CEO的九大特征
- matlab自带函数实现高斯滤波
- 取得IOS设备型号
- 欢迎使用CSDN-markdown编辑器
- iOS/mac开发的一些知名个人博客
- lua string.dump
- Tomcat 安全配置与性能优化 http://netkiller.github.io/journal/tomcat.html
- hive job oom问题
- 初用Android studio出现的问题
- IOS NSURL基本操作
- Android实现通过浏览器点击链接打开本地应用(APP)并拿到浏览器传递的数据
- 自用广告过滤规则,整合xwhyc大大的,很小才79K
- Movie recommendation based on collaborative filtering method
- 小金登陆游戏