lua函数说明

来源:互联网 发布:mediawiki 数据库配置 编辑:程序博客网 时间:2024/06/08 06:57

debug.getinfo([thread],function[,what])

function,可以是一个数,0代表(getinfo),1代表调用getinfo的函数,如果超出调用堆栈函数返回nil.

what,可以是下面的字符或者它们的组合,getinfo将根据what来填充返回的表.

'n'填充name和namewhat字段

'S'填充source,short_src,linedefined,lastlinedefined和what

'l'填充currentline,函数当前执行.

'u' 填充nups,函数的upvalue数量.

'f'填充func,level对应的函数.

'L' pushes onto the stack a table whose indices are the numbers of the lines that are valid on the function. (A valid line is a line with some associated code, that is, a line where you can put a break point. Non-valid lines include empty lines and comments.) 


debug.getfunv(o)

返回对象o的环境.如果这样使用debug.getfunv(debug.getinfo(level,'f').func)就可以访问level的环境表.




0 0
原创粉丝点击