Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
ltm.h File Reference
#include "lobject.h"

Go to the source code of this file.

Macros

#define gfasttm(g, et, e)
 
#define fasttm(l, et, e)   gfasttm(G(l), et, e)
 

Enumerations

enum  TMS {
  TM_INDEX , TM_NEWINDEX , TM_GC , TM_MODE ,
  TM_EQ , TM_ADD , TM_SUB , TM_MUL ,
  TM_DIV , TM_MOD , TM_POW , TM_UNM ,
  TM_LEN , TM_LT , TM_LE , TM_CONCAT ,
  TM_CALL , TM_N
}
 

Functions

LUAI_FUNC const TValueluaT_gettm (Table *events, TMS event, TString *ename)
 
LUAI_FUNC const TValueluaT_gettmbyobj (lua_State *L, const TValue *o, TMS event)
 
LUAI_FUNC void luaT_init (lua_State *L)
 

Variables

LUAI_DATA const char *const luaT_typenames []
 

Macro Definition Documentation

◆ fasttm

◆ gfasttm

#define gfasttm ( g,
et,
e )
Value:
((et) == NULL ? NULL : \
((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))
#define NULL
Definition gmacros.h:924
LUAI_FUNC const TValue * luaT_gettm(Table *events, TMS event, TString *ename)
static TString ** tmname

Definition at line 41 of file lua-5.1.5/src/ltm.h.

41#define gfasttm(g,et,e) ((et) == NULL ? NULL : \
42 ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))

Referenced by luaC_checkfinalizer(), traversetable(), traversetable(), traversetable(), and traversetable().

Enumeration Type Documentation

◆ TMS

enum TMS
Enumerator
TM_INDEX 
TM_NEWINDEX 
TM_GC 
TM_MODE 
TM_EQ 
TM_ADD 
TM_SUB 
TM_MUL 
TM_DIV 
TM_MOD 
TM_POW 
TM_UNM 
TM_LEN 
TM_LT 
TM_LE 
TM_CONCAT 
TM_CALL 
TM_N 

Definition at line 18 of file lua-5.1.5/src/ltm.h.

18 {
21 TM_GC,
22 TM_MODE,
23 TM_EQ, /* last tag method with `fast' access */
24 TM_ADD,
25 TM_SUB,
26 TM_MUL,
27 TM_DIV,
28 TM_MOD,
29 TM_POW,
30 TM_UNM,
31 TM_LEN,
32 TM_LT,
33 TM_LE,
35 TM_CALL,
36 TM_N /* number of elements in the enum */
37} TMS;
@ TM_GC
@ TM_NEWINDEX
@ TM_MODE
@ TM_MUL
@ TM_INDEX
@ TM_UNM
@ TM_EQ
@ TM_POW
@ TM_DIV
@ TM_LEN
@ TM_SUB
@ TM_ADD
@ TM_CALL
@ TM_LE
@ TM_CONCAT
@ TM_LT
@ TM_MOD

Function Documentation

◆ luaT_gettm()

LUAI_FUNC const TValue * luaT_gettm ( Table * events,
TMS event,
TString * ename )

Definition at line 50 of file lua-5.1.5/src/ltm.c.

50 {
51 const TValue *tm = luaH_getstr(events, ename);
52 lua_assert(event <= TM_EQ);
53 if (ttisnil(tm)) { /* no tag method? */
54 events->flags |= cast_byte(1u<<event); /* cache this fact */
55 return NULL;
56 }
57 else return tm;
58}
#define cast_byte(i)
#define lua_assert(c)
#define ttisnil(o)
const TValue * luaH_getstr(Table *t, TString *key)

◆ luaT_gettmbyobj()

LUAI_FUNC const TValue * luaT_gettmbyobj ( lua_State * L,
const TValue * o,
TMS event )

Definition at line 61 of file lua-5.1.5/src/ltm.c.

61 {
62 Table *mt;
63 switch (ttype(o)) {
64 case LUA_TTABLE:
65 mt = hvalue(o)->metatable;
66 break;
67 case LUA_TUSERDATA:
68 mt = uvalue(o)->metatable;
69 break;
70 default:
71 mt = G(L)->mt[ttype(o)];
72 }
73 return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject);
74}
#define uvalue(o)
#define hvalue(o)
#define luaO_nilobject
#define ttype(o)
#define G(L)
#define LUA_TTABLE
#define LUA_TUSERDATA
struct Table * metatable

◆ luaT_init()

LUAI_FUNC void luaT_init ( lua_State * L)

Definition at line 30 of file lua-5.1.5/src/ltm.c.

30 {
31 static const char *const luaT_eventname[] = { /* ORDER TM */
32 "__index", "__newindex",
33 "__gc", "__mode", "__eq",
34 "__add", "__sub", "__mul", "__div", "__mod",
35 "__pow", "__unm", "__len", "__lt", "__le",
36 "__concat", "__call"
37 };
38 int i;
39 for (i=0; i<TM_N; i++) {
40 G(L)->tmname[i] = luaS_new(L, luaT_eventname[i]);
41 luaS_fix(G(L)->tmname[i]); /* never collect these names */
42 }
43}
#define luaS_new(L, s)
#define luaS_fix(s)

Variable Documentation

◆ luaT_typenames

LUAI_DATA const char* const luaT_typenames[]

Definition at line 46 of file lua-5.1.5/src/ltm.h.