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