1 /* 2 ** $Id: luadebug.h,v 1.1 2001/10/29 17:49:53 rr9 Exp $ 3 ** Debugging API 4 ** See Copyright Notice in lua.h 5 */ 6 7 8 #ifndef luadebug_h 9 #define luadebug_h 10 11 12 #include "lua.h" 13 14 typedef struct lua_Debug lua_Debug; /* activation record */ 15 typedef struct lua_Localvar lua_Localvar; 16 17 typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); 18 19 20 LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar); 21 LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar); 22 LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n); 23 LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n); 24 25 LUA_API lua_Hook lua_setcallhook (lua_State *L, lua_Hook func); 26 LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func); 27 28 29 #define LUA_IDSIZE 60 30 31 struct lua_Debug { 32 const char *event; /* `call', `return' */ 33 int currentline; /* (l) */ 34 const char *name; /* (n) */ 35 const char *namewhat; /* (n) `global', `tag method', `local', `field' */ 36 int nups; /* (u) number of upvalues */ 37 int linedefined; /* (S) */ 38 const char *what; /* (S) `Lua' function, `C' function, Lua `main' */ 39 const char *source; /* (S) */ 40 char short_src[LUA_IDSIZE]; /* (S) */ 41 /* private part */ 42 struct lua_TObject *_func; /* active function */ 43 }; 44 45 46 #endif 47