ltm.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. ** $Id: ltm.h,v 2.6.1.1 2007/12/27 13:02:25 roberto Exp $
  3. ** Tag methods
  4. ** See Copyright Notice in lua.h
  5. */
  6. #ifndef ltm_h
  7. #define ltm_h
  8. #include "lobject.h"
  9. /*
  10. * WARNING: if you change the order of this enumeration,
  11. * grep "ORDER TM"
  12. */
  13. typedef enum
  14. {
  15. TM_INDEX,
  16. TM_NEWINDEX,
  17. TM_GC,
  18. TM_MODE,
  19. TM_EQ, /* last tag method with `fast' access */
  20. TM_ADD,
  21. TM_SUB,
  22. TM_MUL,
  23. TM_DIV,
  24. TM_MOD,
  25. TM_POW,
  26. TM_UNM,
  27. TM_LEN,
  28. TM_LT,
  29. TM_LE,
  30. TM_CONCAT,
  31. TM_CALL,
  32. TM_N /* number of elements in the enum */
  33. } TMS;
  34. #define gfasttm(g,et,e) ((et) == NULL ? NULL : \
  35. !luaR_isrotable(et) && ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))
  36. #define fasttm(l,et,e) gfasttm(G(l), et, e)
  37. LUAI_DATA const char *const luaT_typenames[];
  38. LUAI_FUNC const TValue *luaT_gettm(Table *events, TMS event, TString *ename);
  39. LUAI_FUNC const TValue *luaT_gettmbyobj(lua_State *L, const TValue *o,
  40. TMS event);
  41. LUAI_FUNC void luaT_init(lua_State *L);
  42. #endif