ltm.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. ** $Id: ltm.h,v 1.17 2000/10/05 12:14:08 roberto Exp roberto $
  3. ** Tag methods
  4. ** See Copyright Notice in lua.h
  5. */
  6. #ifndef ltm_h
  7. #define ltm_h
  8. #include "lobject.h"
  9. #include "lstate.h"
  10. /*
  11. * WARNING: if you change the order of this enumeration,
  12. * grep "ORDER TM"
  13. */
  14. typedef enum {
  15. TM_GETTABLE = 0,
  16. TM_SETTABLE,
  17. TM_INDEX,
  18. TM_GETGLOBAL,
  19. TM_SETGLOBAL,
  20. TM_ADD,
  21. TM_SUB,
  22. TM_MUL,
  23. TM_DIV,
  24. TM_POW,
  25. TM_UNM,
  26. TM_LT,
  27. TM_CONCAT,
  28. TM_GC,
  29. TM_FUNCTION,
  30. TM_N /* number of elements in the enum */
  31. } TMS;
  32. struct TM {
  33. Closure *method[TM_N];
  34. TString *collected; /* list of garbage-collected udata with this tag */
  35. };
  36. #define luaT_gettm(L,tag,event) (L->TMtable[tag].method[event])
  37. #define luaT_gettmbyObj(L,o,e) (luaT_gettm((L),luaT_tag(o),(e)))
  38. #define validtag(t) (NUM_TAGS <= (t) && (t) <= L->last_tag)
  39. extern const char *const luaT_eventname[];
  40. void luaT_init (lua_State *L);
  41. void luaT_realtag (lua_State *L, int tag);
  42. int luaT_tag (const TObject *o);
  43. int luaT_validevent (int t, int e); /* used by compatibility module */
  44. #endif