本博客注有“转”字样的为转载文章,其余为本人原创文章,,转载请务必注明来由或生存此段。c++/lua/windows逆向交流群:69148232
每一个lua api 函数结尾都给出了这样的说明例如:
[-0, +1, –]
这是什么意思呢。
方括号里面有三个字段我们称为[-o, +p, x]
第一个字段o暗示挪用函数后会从栈中弹出几多个元素
第二个字段p暗示挪用函数后会压入几多元素到栈中
如果o或p这两个字段的格局是x|y类型暗示这挪用这个函数会压入(弹出)栈的个数x或者y个。他是按照差别情况的。
如果o或p中带有?暗示我不知道将会压入(弹出)几多个元素,要视具体参数而定。
第三个字段x暗示这个函数是否会抛出异常。“-”代表些函数从来不会抛出异常。“m”暗示这个函数会抛出内存溢出异常或错误执行__gc函数。‘e‘代表这个函数有可能抛出异常。‘v’暗示这个函数会抛出一个错误。
例如:
void lua_settable (lua_State *L, int index); [-2, +0, e]
[-2, +0, e] 有球settable会弹出2个元素压入0个元素,这个函数会抛堕落误。
Here we list all functions and types from the C API in alphabetical order. Each function has an indicator like this:[-o, +p, x]
The first field, o, is how many elements the function pops from the stack. The second field, p, is how many elements the function pushes onto the stack. (Any function always pushes its results after popping its arguments.) A field in the form x|y means the function can push (or pop) x or y elements, depending on the situation; an interrogation mark ‘?‘ means that we cannot know how many elements the function pops/pushes by looking only at its arguments (e.g., they may depend on what is on the stack). The third field, x, tells whether the function may raise errors: ‘-‘ means the function never raises any error; ‘m‘ means the function may raise out-of-memory errors and errors running a __gc metamethod; ‘e‘ means the function may raise any errors (it can run arbitrary Lua code, either directly or through metamethods); ‘v‘ means the function may raise an error on purpose.
lua api 官方文档 函数后面的方括号 说明 [-0, +0, –]
标签:
原文地点:https://www.cnblogs.com/zhangdongsheng/p/8971761.html