lua/ltm.h

60 lines
1.0 KiB
C
Raw Normal View History

1997-09-17 03:25:59 +08:00
/*
** $Id: ltm.h,v 1.17 2000/10/05 12:14:08 roberto Exp roberto $
1997-09-17 03:25:59 +08:00
** Tag methods
** See Copyright Notice in lua.h
*/
#ifndef ltm_h
#define ltm_h
#include "lobject.h"
#include "lstate.h"
1997-09-17 03:25:59 +08:00
/*
* WARNING: if you change the order of this enumeration,
* grep "ORDER TM"
1997-09-17 03:25:59 +08:00
*/
typedef enum {
TM_GETTABLE = 0,
TM_SETTABLE,
TM_INDEX,
TM_GETGLOBAL,
TM_SETGLOBAL,
TM_ADD,
TM_SUB,
TM_MUL,
TM_DIV,
TM_POW,
TM_UNM,
TM_LT,
TM_CONCAT,
TM_GC,
TM_FUNCTION,
TM_N /* number of elements in the enum */
} TMS;
struct TM {
Closure *method[TM_N];
TString *collected; /* list of garbage-collected udata with this tag */
};
1997-09-17 03:25:59 +08:00
#define luaT_gettm(L,tag,event) (L->TMtable[tag].method[event])
#define luaT_gettmbyObj(L,o,e) (luaT_gettm((L),luaT_tag(o),(e)))
2000-10-05 20:14:08 +08:00
#define validtag(t) (NUM_TAGS <= (t) && (t) <= L->last_tag)
1997-09-17 03:25:59 +08:00
1999-08-17 04:52:00 +08:00
extern const char *const luaT_eventname[];
1997-09-17 03:25:59 +08:00
void luaT_init (lua_State *L);
void luaT_realtag (lua_State *L, int tag);
2000-10-05 20:14:08 +08:00
int luaT_tag (const TObject *o);
int luaT_validevent (int t, int e); /* used by compatibility module */
1997-09-17 03:25:59 +08:00
#endif