sdk-world
v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Toggle main menu visibility
Loading...
Searching...
No Matches
ltm.h
Go to the documentation of this file.
1
/*
2
** $Id: ltm.h $
3
** Tag methods
4
** See Copyright Notice in lua.h
5
*/
6
11
#ifndef ltm_h
12
#define ltm_h
13
14
15
#include "
lobject.h
"
16
#include "
lstate.h
"
17
18
19
/*
20
* WARNING: if you change the order of this enumeration,
21
* grep "ORDER TM" and "ORDER OP"
22
*/
23
typedef
enum
{
24
TM_INDEX,
25
TM_NEWINDEX,
26
TM_GC,
27
TM_MODE,
28
TM_LEN,
29
TM_EQ,
/* last tag method with fast access */
30
TM_ADD,
31
TM_SUB,
32
TM_MUL,
33
TM_MOD,
34
TM_POW,
35
TM_DIV,
36
TM_IDIV,
37
TM_BAND,
38
TM_BOR,
39
TM_BXOR,
40
TM_SHL,
41
TM_SHR,
42
TM_UNM,
43
TM_BNOT,
44
TM_LT,
45
TM_LE,
46
TM_CONCAT,
47
TM_CALL,
48
TM_CLOSE,
49
TM_N
/* number of elements in the enum */
50
} TMS;
51
52
53
/*
54
** Mask with 1 in all fast-access methods. A 1 in any of these bits
55
** in the flag of a (meta)table means the metatable does not have the
56
** corresponding metamethod field. (Bit 7 of the flag is used for
57
** 'isrealasize'.)
58
*/
59
#define maskflags (~(~0u << (TM_EQ + 1)))
60
61
62
/*
63
** Test whether there is no tagmethod.
64
** (Because tagmethods use raw accesses, the result may be an "empty" nil.)
65
*/
66
#define notm(tm) ttisnil(tm)
67
68
69
#define gfasttm(g,et,e) ((et) == NULL ? NULL : \
70
((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e]))
71
72
#define fasttm(l,et,e) gfasttm(G(l), et, e)
73
74
#define ttypename(x) luaT_typenames_[(x) + 1]
75
76
LUAI_DDEC(
const
char
*
const
luaT_typenames_[LUA_TOTALTYPES];)
77
78
79
LUAI_FUNC
const
char
*luaT_objtypename (
lua_State
*L,
const
TValue
*o);
80
81
LUAI_FUNC
const
TValue
*luaT_gettm (
Table
*events, TMS event,
TString
*ename);
82
LUAI_FUNC
const
TValue
*luaT_gettmbyobj (
lua_State
*L,
const
TValue
*o,
83
TMS event);
84
LUAI_FUNC
void
luaT_init (
lua_State
*L);
85
86
LUAI_FUNC
void
luaT_callTM (
lua_State
*L,
const
TValue
*f,
const
TValue
*p1,
87
const
TValue
*p2,
const
TValue
*p3);
88
LUAI_FUNC
void
luaT_callTMres (
lua_State
*L,
const
TValue
*f,
89
const
TValue
*p1,
const
TValue
*p2, StkId p3);
90
LUAI_FUNC
void
luaT_trybinTM (
lua_State
*L,
const
TValue
*p1,
const
TValue
*p2,
91
StkId res, TMS event);
92
LUAI_FUNC
void
luaT_tryconcatTM (
lua_State
*L);
93
LUAI_FUNC
void
luaT_trybinassocTM (
lua_State
*L,
const
TValue
*p1,
94
const
TValue
*p2,
int
inv, StkId res, TMS event);
95
LUAI_FUNC
void
luaT_trybiniTM (
lua_State
*L,
const
TValue
*p1, lua_Integer i2,
96
int
inv, StkId res, TMS event);
97
LUAI_FUNC
int
luaT_callorderTM (
lua_State
*L,
const
TValue
*p1,
98
const
TValue
*p2, TMS event);
99
LUAI_FUNC
int
luaT_callorderiTM (
lua_State
*L,
const
TValue
*p1,
int
v2,
100
int
inv,
int
isfloat, TMS event);
101
102
LUAI_FUNC
void
luaT_adjustvarargs (
lua_State
*L,
int
nfixparams,
103
CallInfo
*ci,
const
Proto
*p);
104
LUAI_FUNC
void
luaT_getvarargs (
lua_State
*L,
CallInfo
*ci,
105
StkId where,
int
wanted);
106
107
108
#endif
lobject.h
lstate.h
CallInfo
Definition
lstate.h:181
Proto
Definition
lobject.h:556
TString
Definition
lobject.h:390
TValue
Definition
lobject.h:71
Table
Definition
lobject.h:743
lua_State
Definition
lstate.h:313
lua
src
ltm.h
Generated by
1.18.0