-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtag.h
39 lines (32 loc) · 897 Bytes
/
tag.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Tag methods.
#pragma once
#include "object.h"
typedef enum {
TM_INDEX,
TM_NEWINDEX,
TM_GC,
TM_MODE,
TM_EQ, /* last tag method with `fast' access */
TM_ADD,
TM_SUB,
TM_MUL,
TM_DIV,
TM_MOD,
TM_POW,
TM_UNM,
TM_LEN,
TM_LT,
TM_LE,
TM_CONCAT,
TM_CALL,
// Number of tag methods.
TM_N,
} TMS;
#define GLOBAL_FAST_TM(g, et, e) \
((et) == nullptr ? nullptr \
: ((et)->flags & (1u << (e))) ? nullptr \
: luaT_gettm(et, e, (g)->tmname[e]))
#define FAST_TM(l, et, e) GLOBAL_FAST_TM(G(l), et, e)
LUAI_FUNC const Value *luaT_gettm(Table *events, TMS event, String *ename);
LUAI_FUNC const Value *luaT_gettmbyobj(lua_State *L, const Value *o, TMS event);
LUAI_FUNC void luaT_init(lua_State *L);