Defines | Functions

# lua/lvm.h File Reference

`#include "ldo.h"`
`#include "lobject.h"`
`#include "ltm.h"`
Include dependency graph for lvm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines
#define | tostring(L, o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o)))
#define | tonumber(o, n)
#define | equalobj(L, o1, o2) (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2))
## Functions
LUAI_FUNC int | luaV_lessthan (lua_State *L, const TValue *l, const TValue *r)
LUAI_FUNC int | luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2)
LUAI_FUNC const TValue * | luaV_tonumber (const TValue *obj, TValue *n)
LUAI_FUNC int | luaV_tostring (lua_State *L, StkId obj)
LUAI_FUNC void | luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val)
LUAI_FUNC void | luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val)
LUAI_FUNC void | luaV_execute (lua_State *L, int nexeccalls)
LUAI_FUNC void | luaV_concat (lua_State *L, int total, int last)

## Define Documentation

#define equalobj | ( |  | L,
|  |  | o1,
|  |  | o2
| ) |  | (ttype(o1) == ttype(o2) && luaV_equalval(L, o1, o2))

Definition at line 21 of file lvm.h.

Referenced by lua_equal(), and luaV_execute().

#define tonumber | ( |  | o,
|  |  | n
| ) |  |

Value:

    (ttype(o) == LUA_TNUMBER || \
                             (((o) = luaV_tonumber(o,n)) != NULL))

Definition at line 18 of file lvm.h.

Referenced by lua_isnumber(), lua_tointeger(), lua_tonumber(), and luaV_execute().

#define tostring | ( |  | L,
|  |  | o
| ) |  | ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o)))

Definition at line 16 of file lvm.h.

Referenced by luaV_concat().

## Function Documentation

LUAI_FUNC void luaV_concat | ( | lua_State * | L,
|  | int | total,
|  | int | last
| ) |  |

Definition at line 278 of file lvm.c.

References lua_State::base, call_binTM(), G, luaG_concaterror(), luaG_runerror(), luaS_newlstr(), luaZ_openspace(), MAX_SIZET, setsvalue2s, svalue, TM_CONCAT, tostring, tsvalue, ttisnumber, and ttisstring.

Referenced by lua_concat(), luaO_pushvfstring(), and luaV_execute().

LUAI_FUNC int luaV_equalval | ( | lua_State * | L,
|  | const TValue * | t1,
|  | const TValue * | t2
| ) |  |

Definition at line 251 of file lvm.c.

References bvalue, callTMres(), gcvalue, get_compTM(), hvalue, l_isfalse, lua_assert, nvalue, pvalue, TM_EQ, lua_State::top, ttype, and uvalue.

LUAI_FUNC void luaV_execute | ( | lua_State * | L,
|  | int | nexeccalls
| ) |  |

Definition at line 373 of file lvm.c.

References Arith(), arith_op, CallInfo::base, lua_State::base, call_binTM(), cast_int, cast_num, lua_State::ci, clvalue, dojump, LClosure::env, equalobj, CallInfo::func, GET_OPCODE, GETARG_A, GETARG_B, GETARG_Bx, GETARG_C, GETARG_sBx, lua_State::hookcount, lua_State::hookmask, hvalue, isLua, Proto::k, KBx, Closure::l, l_isfalse, lessequal(), LFIELDS_PER_FLUSH, lua_assert, luaC_barrier, luaC_barriert, luaC_checkGC, luaD_call(), luaD_checkstack, luaD_poscall(), luaD_precall(), luaF_close(), luaF_findupval(), luaF_newLclosure(), luaG_checkopenop(), luaG_runerror(), luaG_typeerror(), luaH_getn(), luaH_new(), luaH_resizearray(), luaH_setnum(), luaO_fb2int(), luaO_nilobject, luaV_concat(), luaV_gettable(), luaV_lessthan(), luaV_settable(), Proto::numparams, Proto::nups, nvalue, OP_ADD, OP_CALL, OP_CLOSE, OP_CLOSURE, OP_CONCAT, OP_DIV, OP_EQ, OP_FORLOOP, OP_FORPREP, OP_GETGLOBAL, OP_GETTABLE, OP_GETUPVAL, OP_JMP, OP_LE, OP_LEN, OP_LOADBOOL, OP_LOADK, OP_LOADNIL, OP_LT, OP_MOD, OP_MOVE, OP_MUL, OP_NEWTABLE, OP_NOT, OP_POW, OP_RETURN, OP_SELF, OP_SETGLOBAL, OP_SETLIST, OP_SETTABLE, OP_SETUPVAL, OP_SUB, OP_TAILCALL, OP_TEST, OP_TESTSET, OP_TFORLOOP, OP_UNM, OP_VARARG, lua_State::openupval, Proto::p, LClosure::p, PCRC, PCRLUA, Protect, RA, RB, RKB, RKC, runtime_check, CallInfo::savedpc, lua_State::savedpc, setbvalue, setclvalue, sethvalue, setnilvalue, setnvalue, setobj, setobj2s, setobj2t, setobjs2s, Table::sizearray, lua_State::stack, lua_State::stacksize, lua_State::status, CallInfo::tailcalls, TM_ADD, TM_DIV, TM_LEN, TM_MOD, TM_MUL, TM_POW, TM_SUB, TM_UNM, tonumber, CallInfo::top, lua_State::top, traceexec(), tsvalue, ttisnil, ttisnumber, ttisstring, ttistable, ttype, LClosure::upvals, and UpVal::v.

Referenced by luaD_call(), and resume().

LUAI_FUNC void luaV_gettable | ( | lua_State * | L,
|  | const TValue * | t,
|  | TValue * | key,
|  | StkId | val
| ) |  |

Definition at line 108 of file lvm.c.

References callTMres(), fasttm, hvalue, luaG_runerror(), luaG_typeerror(), luaH_get(), luaT_gettmbyobj(), MAXTAGLOOP, Table::metatable, setobj2s, TM_INDEX, ttisfunction, ttisnil, and ttistable.

Referenced by lua_getfield(), lua_gettable(), and luaV_execute().

LUAI_FUNC int luaV_lessthan | ( | lua_State * | L,
|  | const TValue * | l,
|  | const TValue * | r
| ) |  |

Definition at line 221 of file lvm.c.

References call_orderTM(), l_strcmp(), luaG_ordererror(), nvalue, rawtsvalue, TM_LT, ttisnumber, ttisstring, and ttype.

Referenced by lua_lessthan(), and luaV_execute().

LUAI_FUNC void luaV_settable | ( | lua_State * | L,
|  | const TValue * | t,
|  | TValue * | key,
|  | StkId | val
| ) |  |

Definition at line 134 of file lvm.c.

References callTM(), fasttm, hvalue, luaC_barriert, luaG_runerror(), luaG_typeerror(), luaH_set(), luaT_gettmbyobj(), MAXTAGLOOP, Table::metatable, setobj2t, TM_NEWINDEX, ttisfunction, ttisnil, and ttistable.

Referenced by lua_setfield(), lua_settable(), and luaV_execute().

LUAI_FUNC const TValue* luaV_tonumber | ( | const TValue * | obj,
|  | TValue * | n
| ) |  |

Definition at line 35 of file lvm.c.

References luaO_str2d(), setnvalue, svalue, ttisnumber, and ttisstring.

Referenced by Arith(), and luaG_aritherror().

LUAI_FUNC int luaV_tostring | ( | lua_State * | L,
|  | StkId | obj
| ) |  |

Definition at line 47 of file lvm.c.

References luaS_new, nvalue, setsvalue2s, and ttisnumber.

Referenced by lua_objlen(), and lua_tolstring().