summaryrefslogtreecommitdiff
path: root/src/lua51/lua.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua51/lua.h')
-rw-r--r--src/lua51/lua.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/lua51/lua.h b/src/lua51/lua.h
index 9f45735..75a8f19 100644
--- a/src/lua51/lua.h
+++ b/src/lua51/lua.h
@@ -30,6 +30,7 @@
#define LUA_MULTRET (-1)
+//c 特殊的表索引
/*
** pseudo-indices
*/
@@ -319,10 +320,10 @@ LUA_API void lua_setlevel (lua_State *from, lua_State *to);
/*
** Event masks
*/
-#define LUA_MASKCALL (1 << LUA_HOOKCALL)
-#define LUA_MASKRET (1 << LUA_HOOKRET)
-#define LUA_MASKLINE (1 << LUA_HOOKLINE)
-#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
+#define LUA_MASKCALL (1 << LUA_HOOKCALL) // 函数调用时触发
+#define LUA_MASKRET (1 << LUA_HOOKRET) // 函数返回时触发
+#define LUA_MASKLINE (1 << LUA_HOOKLINE) // 每执行一个指令触发
+#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) // 每执行n个指令触发
typedef struct lua_Debug lua_Debug; /* activation record */
@@ -344,9 +345,11 @@ LUA_API int lua_gethookmask (lua_State *L);
LUA_API int lua_gethookcount (lua_State *L);
+//c 当前执行信息,用来调试程序
+// 通过lua_getinfo能够得到信息
struct lua_Debug {
- int event;
- const char *name; /* (n) */
+ int event; // hook事件
+ const char *name; /* (n) */ // 当前函数名
const char *namewhat; /* (n) `global', `local', `field', `method' */
const char *what; /* (S) `Lua', `C', `main', `tail' */
const char *source; /* (S) */