luadebug.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. ** $Id: luadebug.h,v 1.27 2002/04/04 17:21:31 roberto Exp roberto $
  3. ** Debugging API
  4. ** See Copyright Notice in lua.h
  5. */
  6. #ifndef luadebug_h
  7. #define luadebug_h
  8. #include "lua.h"
  9. typedef struct lua_Debug lua_Debug; /* activation record */
  10. typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
  11. LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);
  12. LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
  13. LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
  14. LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
  15. LUA_API lua_Hook lua_setcallhook (lua_State *L, lua_Hook func);
  16. LUA_API lua_Hook lua_setlinehook (lua_State *L, lua_Hook func);
  17. #define LUA_IDSIZE 60
  18. struct lua_Debug {
  19. const char *event; /* `call', `return', `line' */
  20. const char *name; /* (n) */
  21. const char *namewhat; /* (n) `global', `local', `field', `method' */
  22. const char *what; /* (S) `Lua' function, `C' function, Lua `main' */
  23. const char *source; /* (S) */
  24. int currentline; /* (l) */
  25. int isprotected; /* (c) function was called in protected mode */
  26. int nups; /* (u) number of upvalues */
  27. int linedefined; /* (S) */
  28. char short_src[LUA_IDSIZE]; /* (S) */
  29. /* private part */
  30. int i_ci; /* active function */
  31. };
  32. #endif