You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.0 KiB

28 years ago
/*
** $Id: ltm.h,v 1.17 2000/10/05 12:14:08 roberto Exp roberto $
28 years ago
** Tag methods
** See Copyright Notice in lua.h
*/
#ifndef ltm_h
#define ltm_h
#include "lobject.h"
#include "lstate.h"
28 years ago
/*
* WARNING: if you change the order of this enumeration,
* grep "ORDER TM"
28 years ago
*/
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 */
};
28 years ago
#define luaT_gettm(L,tag,event) (L->TMtable[tag].method[event])
#define luaT_gettmbyObj(L,o,e) (luaT_gettm((L),luaT_tag(o),(e)))
#define validtag(t) (NUM_TAGS <= (t) && (t) <= L->last_tag)
28 years ago
extern const char *const luaT_eventname[];
28 years ago
void luaT_init (lua_State *L);
void luaT_realtag (lua_State *L, int tag);
int luaT_tag (const TObject *o);
int luaT_validevent (int t, int e); /* used by compatibility module */
28 years ago
#endif