# lua/lapi.c File Reference

`#include <assert.h>`
`#include <math.h>`
`#include <stdarg.h>`
`#include <string.h>`
`#include "lua.h"`
`#include "lapi.h"`
`#include "ldebug.h"`
`#include "ldo.h"`
`#include "lfunc.h"`
`#include "lgc.h"`
`#include "lmem.h"`
`#include "lobject.h"`
`#include "lstate.h"`
`#include "lstring.h"`
`#include "ltable.h"`
`#include "ltm.h"`
`#include "lundump.h"`
`#include "lvm.h"`

Include dependency graph for lapi.c:

Go to the source code of this file.

## Data Structures
struct | CallS
struct | CCallS
## Defines
#define | lapi_c
#define | LUA_CORE
#define | api_checknelems(L, n) api_check(L, (n) <= (L->top - L->base))
#define | api_checkvalidindex(L, i) api_check(L, (i) != luaO_nilobject)
#define | api_incr_top(L) {api_check(L, L->top < L->ci->top); L->top++;}
#define | adjustresults(L, nres) { if (nres == LUA_MULTRET && L->top >= L->ci->top) L->ci->top = L->top; }
#define | checkresults(L, na, nr) api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)))
## Functions
static TValue * | index2adr (lua_State *L, int idx)
static Table * | getcurrenv (lua_State *L)
void | luaA_pushobject (lua_State *L, const TValue *o)
int | lua_checkstack (lua_State *L, int size)
void | lua_xmove (lua_State *from, lua_State *to, int n)
lua_CFunction | lua_atpanic (lua_State *L, lua_CFunction panicf)
lua_State * | lua_newthread (lua_State *L)
int | lua_gettop (lua_State *L)
void | lua_settop (lua_State *L, int idx)
void | lua_remove (lua_State *L, int idx)
void | lua_insert (lua_State *L, int idx)
void | lua_replace (lua_State *L, int idx)
void | lua_pushvalue (lua_State *L, int idx)
int | lua_type (lua_State *L, int idx)
const char * | lua_typename (lua_State *L, int t)
int | lua_iscfunction (lua_State *L, int idx)
int | lua_isnumber (lua_State *L, int idx)
int | lua_isstring (lua_State *L, int idx)
int | lua_isuserdata (lua_State *L, int idx)
int | lua_rawequal (lua_State *L, int index1, int index2)
int | lua_equal (lua_State *L, int index1, int index2)
int | lua_lessthan (lua_State *L, int index1, int index2)
lua_Number | lua_tonumber (lua_State *L, int idx)
lua_Integer | lua_tointeger (lua_State *L, int idx)
int | lua_toboolean (lua_State *L, int idx)
const char * | lua_tolstring (lua_State *L, int idx, size_t *len)
size_t | lua_objlen (lua_State *L, int idx)
lua_CFunction | lua_tocfunction (lua_State *L, int idx)
void * | lua_touserdata (lua_State *L, int idx)
lua_State * | lua_tothread (lua_State *L, int idx)
const void * | lua_topointer (lua_State *L, int idx)
void | lua_pushnil (lua_State *L)
void | lua_pushnumber (lua_State *L, lua_Number n)
void | lua_pushinteger (lua_State *L, lua_Integer n)
void | lua_pushlstring (lua_State *L, const char *s, size_t len)
void | lua_pushstring (lua_State *L, const char *s)
const char * | lua_pushvfstring (lua_State *L, const char *fmt, va_list argp)
const char * | lua_pushfstring (lua_State *L, const char *fmt,...)
void | lua_pushcclosure (lua_State *L, lua_CFunction fn, int n)
void | lua_pushboolean (lua_State *L, int b)
void | lua_pushlightuserdata (lua_State *L, void *p)
int | lua_pushthread (lua_State *L)
void | lua_gettable (lua_State *L, int idx)
void | lua_getfield (lua_State *L, int idx, const char *k)
void | lua_rawget (lua_State *L, int idx)
void | lua_rawgeti (lua_State *L, int idx, int n)
void | lua_createtable (lua_State *L, int narray, int nrec)
int | lua_getmetatable (lua_State *L, int objindex)
void | lua_getfenv (lua_State *L, int idx)
void | lua_settable (lua_State *L, int idx)
void | lua_setfield (lua_State *L, int idx, const char *k)
void | lua_rawset (lua_State *L, int idx)
void | lua_rawseti (lua_State *L, int idx, int n)
int | lua_setmetatable (lua_State *L, int objindex)
int | lua_setfenv (lua_State *L, int idx)
void | lua_call (lua_State *L, int nargs, int nresults)
static void | f_call (lua_State *L, void *ud)
int | lua_pcall (lua_State *L, int nargs, int nresults, int errfunc)
static void | f_Ccall (lua_State *L, void *ud)
int | lua_cpcall (lua_State *L, lua_CFunction func, void *ud)
int | lua_load (lua_State *L, lua_Reader reader, void *data, const char *chunkname)
int | lua_dump (lua_State *L, lua_Writer writer, void *data)
int | lua_status (lua_State *L)
int | lua_gc (lua_State *L, int what, int data)
int | lua_error (lua_State *L)
int | lua_next (lua_State *L, int idx)
void | lua_concat (lua_State *L, int n)
lua_Alloc | lua_getallocf (lua_State *L, void **ud)
void | lua_setallocf (lua_State *L, lua_Alloc f, void *ud)
void * | lua_newuserdata (lua_State *L, size_t size)
static const char * | aux_upvalue (StkId fi, int n, TValue **val)
const char * | lua_getupvalue (lua_State *L, int funcindex, int n)
const char * | lua_setupvalue (lua_State *L, int funcindex, int n)
## Variables
const char | lua_ident []

## Define Documentation

#define adjustresults | ( | L,
|  | nres |  | ) | { if (nres == LUA_MULTRET && L->top >= L->ci->top) L->ci->top = L->top; }

Definition at line 764 of file lapi.c.

Referenced by lua_call(), and lua_pcall().

#define api_checknelems | ( | L,
|  | n |  | ) | api_check(L, (n) <= (L->top - L->base))

Definition at line 41 of file lapi.c.

Referenced by lua_call(), lua_concat(), lua_dump(), lua_error(), lua_pcall(), lua_pushcclosure(), lua_rawset(), lua_rawseti(), lua_replace(), lua_setfenv(), lua_setfield(), lua_setmetatable(), lua_settable(), lua_setupvalue(), and lua_xmove().

#define api_checkvalidindex | ( | L,
|  | i |  | ) | api_check(L, (i) != luaO_nilobject)

Definition at line 43 of file lapi.c.

Referenced by lua_getfenv(), lua_getfield(), lua_gettable(), lua_insert(), lua_pcall(), lua_remove(), lua_replace(), lua_setfenv(), lua_setfield(), lua_setmetatable(), and lua_settable().

#define api_incr_top | ( | L |  | ) | {api_check(L, L->top < L->ci->top); L->top++;}

Definition at line 45 of file lapi.c.

Referenced by f_Ccall(), lua_concat(), lua_createtable(), lua_getfenv(), lua_getfield(), lua_getmetatable(), lua_getupvalue(), lua_newthread(), lua_newuserdata(), lua_next(), lua_pushboolean(), lua_pushcclosure(), lua_pushinteger(), lua_pushlightuserdata(), lua_pushlstring(), lua_pushnil(), lua_pushnumber(), lua_pushthread(), lua_pushvalue(), lua_rawgeti(), and luaA_pushobject().

#define checkresults | ( | L,
|  | na,
|  | nr |  | ) | api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)))

Definition at line 768 of file lapi.c.

Referenced by lua_call(), and lua_pcall().

#define lapi_c

Definition at line 13 of file lapi.c.

#define LUA_CORE

Definition at line 14 of file lapi.c.

## Function Documentation

static const char* aux_upvalue | ( | StkId | fi,
|  | int | n,
|  | TValue ** | val |
| ) |  |  | `[static]`

Definition at line 1032 of file lapi.c.

References Closure::c, clvalue, getstr, CClosure::isC, Closure::l, LClosure::p, ttisfunction, LClosure::upvals, CClosure::upvalue, Proto::upvalues, and UpVal::v.

Referenced by lua_getupvalue(), and lua_setupvalue().

static void f_call | ( | lua_State * | L,
|  | void * | ud |
| ) |  |  | `[static]`

Definition at line 794 of file lapi.c.

References cast, CallS::func, luaD_call(), and CallS::nresults.

Referenced by lua_pcall().

static void f_Ccall | ( | lua_State * | L,
|  | void * | ud |
| ) |  |  | `[static]`

Definition at line 833 of file lapi.c.

References api_incr_top, Closure::c, cast, CClosure::f, CCallS::func, getcurrenv(), luaD_call(), luaF_newCclosure(), setclvalue, setpvalue, lua_State::top, and CCallS::ud.

Referenced by lua_cpcall().

static Table* getcurrenv | ( | lua_State * | L | ) | `[static]`

Definition at line 79 of file lapi.c.

References lua_State::base_ci, Closure::c, lua_State::ci, curr_func, CClosure::env, gt, and hvalue.

Referenced by f_Ccall(), lua_newuserdata(), and lua_pushcclosure().

static TValue* index2adr | ( | lua_State * | L,
|  | int | idx |
| ) |  |  | `[static]`

Definition at line 49 of file lapi.c.

References api_check, lua_State::base, Closure::c, cast, curr_func, CClosure::env, lua_State::env, gt, luaO_nilobject, registry, sethvalue, lua_State::top, and CClosure::upvalue.

Referenced by lua_equal(), lua_getfenv(), lua_getfield(), lua_getmetatable(), lua_gettable(), lua_getupvalue(), lua_insert(), lua_iscfunction(), lua_isnumber(), lua_isuserdata(), lua_lessthan(), lua_next(), lua_objlen(), lua_pcall(), lua_pushvalue(), lua_rawequal(), lua_rawget(), lua_rawgeti(), lua_rawset(), lua_rawseti(), lua_remove(), lua_replace(), lua_setfenv(), lua_setfield(), lua_setmetatable(), lua_settable(), lua_setupvalue(), lua_toboolean(), lua_tocfunction(), lua_tointeger(), lua_tolstring(), lua_tonumber(), lua_topointer(), lua_tothread(), lua_touserdata(), and lua_type().

lua_CFunction lua_atpanic | ( | lua_State * | L,
|  | lua_CFunction | panicf |
| ) |  |  |

Definition at line 126 of file lapi.c.

References G, lua_lock, and lua_unlock.

void lua_call | ( | lua_State * | L,
|  | int | nargs,
|  | int | nresults |
| ) |  |  |

Definition at line 772 of file lapi.c.

References adjustresults, api_checknelems, checkresults, lua_lock, lua_unlock, luaD_call(), and lua_State::top.

int lua_checkstack | ( | lua_State * | L,
|  | int | size |
| ) |  |  |

Definition at line 95 of file lapi.c.

References lua_State::base, lua_State::ci, lua_lock, lua_unlock, luaD_checkstack, CallInfo::top, and lua_State::top.

void lua_concat | ( | lua_State * | L,
|  | int | n |
| ) |  |  |

Definition at line 983 of file lapi.c.

References api_checknelems, api_incr_top, lua_State::base, cast_int, lua_lock, lua_unlock, luaC_checkGC, luaS_newlstr(), luaV_concat(), setsvalue2s, and lua_State::top.

int lua_cpcall | ( | lua_State * | L,
|  | lua_CFunction | func,
|  | void * | ud |
| ) |  |  |

Definition at line 846 of file lapi.c.

References f_Ccall(), CCallS::func, lua_lock, lua_unlock, luaD_pcall(), savestack, lua_State::top, and CCallS::ud.

void lua_createtable | ( | lua_State * | L,
|  | int | narray,
|  | int | nrec |
| ) |  |  |

Definition at line 574 of file lapi.c.

References api_incr_top, lua_lock, lua_unlock, luaC_checkGC, luaH_new(), sethvalue, and lua_State::top.

int lua_dump | ( | lua_State * | L,
|  | lua_Writer | writer,
|  | void * | data |
| ) |  |  |

Definition at line 871 of file lapi.c.

References api_checknelems, clvalue, isLfunction, lua_lock, lua_unlock, luaU_dump(), and lua_State::top.

int lua_equal | ( | lua_State * | L,
|  | int | index1,
|  | int | index2 |
| ) |  |  |

Definition at line 283 of file lapi.c.

References equalobj, index2adr(), lua_lock, lua_unlock, and luaO_nilobject.

int lua_error | ( | lua_State * | L | ) |

Definition at line 957 of file lapi.c.

References api_checknelems, lua_lock, lua_unlock, and luaG_errormsg().

int lua_gc | ( | lua_State * | L,
|  | int | what,
|  | int | data |
| ) |  |  |

Definition at line 895 of file lapi.c.

References cast, cast_int, G, global_State::gcpause, GCSpause, global_State::gcstate, global_State::gcstepmul, global_State::GCthreshold, lua_lock, lua_unlock, luaC_fullgc(), luaC_step(), MAX_LUMEM, and global_State::totalbytes.

lua_Alloc lua_getallocf | ( | lua_State * | L,
|  | void ** | ud |
| ) |  |  |

Definition at line 1000 of file lapi.c.

References G, lua_lock, and lua_unlock.

void lua_getfenv | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 612 of file lapi.c.

References api_checkvalidindex, api_incr_top, clvalue, gt, index2adr(), lua_lock, lua_unlock, sethvalue, setnilvalue, setobj2s, thvalue, lua_State::top, ttype, and uvalue.

void lua_getfield | ( | lua_State * | L,
|  | int | idx,
|  | const char * | k |
| ) |  |  |

Definition at line 540 of file lapi.c.

References api_checkvalidindex, api_incr_top, index2adr(), lua_lock, lua_unlock, luaS_new, luaV_gettable(), setsvalue, and lua_State::top.

int lua_getmetatable | ( | lua_State * | L,
|  | int | objindex |
| ) |  |  |

Definition at line 583 of file lapi.c.

References api_incr_top, G, hvalue, index2adr(), lua_lock, lua_unlock, sethvalue, lua_State::top, ttype, and uvalue.

void lua_gettable | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 530 of file lapi.c.

References api_checkvalidindex, index2adr(), lua_lock, lua_unlock, luaV_gettable(), and lua_State::top.

int lua_gettop | ( | lua_State * | L | ) |

Definition at line 155 of file lapi.c.

References lua_State::base, cast_int, and lua_State::top.

const char* lua_getupvalue | ( | lua_State * | L,
|  | int | funcindex,
|  | int | n |
| ) |  |  |

Definition at line 1050 of file lapi.c.

References api_incr_top, aux_upvalue(), index2adr(), lua_lock, lua_unlock, setobj2s, and lua_State::top.

void lua_insert | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 187 of file lapi.c.

References api_checkvalidindex, index2adr(), lua_lock, lua_unlock, setobjs2s, and lua_State::top.

int lua_iscfunction | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 250 of file lapi.c.

References index2adr(), and iscfunction.

int lua_isnumber | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 256 of file lapi.c.

References index2adr(), and tonumber.

int lua_isstring | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 263 of file lapi.c.

References lua_type().

int lua_isuserdata | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 269 of file lapi.c.

References index2adr(), ttislightuserdata, and ttisuserdata.

int lua_lessthan | ( | lua_State * | L,
|  | int | index1,
|  | int | index2 |
| ) |  |  |

Definition at line 295 of file lapi.c.

References index2adr(), lua_lock, lua_unlock, luaO_nilobject, and luaV_lessthan().

int lua_load | ( | lua_State * | L,
|  | lua_Reader | reader,
|  | void * | data,
|  | const char * | chunkname |
| ) |  |  |

Definition at line 858 of file lapi.c.

References lua_lock, lua_unlock, luaD_protectedparser(), and luaZ_init().

lua_State* lua_newthread | ( | lua_State * | L | ) |

Definition at line 136 of file lapi.c.

References api_incr_top, lua_lock, lua_unlock, luaC_checkGC, luaE_newthread(), setthvalue, and lua_State::top.

void* lua_newuserdata | ( | lua_State * | L,
|  | size_t | size |
| ) |  |  |

Definition at line 1018 of file lapi.c.

References api_incr_top, getcurrenv(), lua_lock, lua_unlock, luaC_checkGC, luaS_newudata(), setuvalue, and lua_State::top.

int lua_next | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 966 of file lapi.c.

References api_check, api_incr_top, hvalue, index2adr(), lua_lock, lua_unlock, luaH_next(), lua_State::top, and ttistable.

size_t lua_objlen | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 357 of file lapi.c.

References hvalue, index2adr(), lua_lock, lua_unlock, luaH_getn(), luaV_tostring(), tsvalue, ttype, and uvalue.

int lua_pcall | ( | lua_State * | L,
|  | int | nargs,
|  | int | nresults,
|  | int | errfunc |
| ) |  |  |

Definition at line 801 of file lapi.c.

References adjustresults, api_checknelems, api_checkvalidindex, checkresults, f_call(), CallS::func, index2adr(), lua_lock, lua_unlock, luaD_pcall(), CallS::nresults, savestack, and lua_State::top.

void lua_pushboolean | ( | lua_State * | L,
|  | int | b |
| ) |  |  |

Definition at line 499 of file lapi.c.

References api_incr_top, lua_lock, lua_unlock, setbvalue, and lua_State::top.

void lua_pushcclosure | ( | lua_State * | L,
|  | lua_CFunction | fn,
|  | int | n |
| ) |  |  |

Definition at line 482 of file lapi.c.

References api_checknelems, api_incr_top, Closure::c, CClosure::f, getcurrenv(), iswhite, lua_assert, lua_lock, lua_unlock, luaC_checkGC, luaF_newCclosure(), obj2gco, setclvalue, setobj2n, lua_State::top, and CClosure::upvalue.

const char* lua_pushfstring | ( | lua_State * | L,
|  | const char * | fmt,
|  |  | ... |
| ) |  |  |

Definition at line 469 of file lapi.c.

References lua_lock, lua_unlock, luaC_checkGC, and luaO_pushvfstring().

void lua_pushinteger | ( | lua_State * | L,
|  | lua_Integer | n |
| ) |  |  |

Definition at line 433 of file lapi.c.

References api_incr_top, cast_num, lua_lock, lua_unlock, setnvalue, and lua_State::top.

void lua_pushlightuserdata | ( | lua_State * | L,
|  | void * | p |
| ) |  |  |

Definition at line 507 of file lapi.c.

References api_incr_top, lua_lock, lua_unlock, setpvalue, and lua_State::top.

void lua_pushlstring | ( | lua_State * | L,
|  | const char * | s,
|  | size_t | len |
| ) |  |  |

Definition at line 441 of file lapi.c.

References api_incr_top, lua_lock, lua_unlock, luaC_checkGC, luaS_newlstr(), setsvalue2s, and lua_State::top.

Referenced by lua_pushstring().

void lua_pushnil | ( | lua_State * | L | ) |

Definition at line 417 of file lapi.c.

References api_incr_top, lua_lock, lua_unlock, setnilvalue, and lua_State::top.

Referenced by lua_pushstring().

void lua_pushnumber | ( | lua_State * | L,
|  | lua_Number | n |
| ) |  |  |

Definition at line 425 of file lapi.c.

References api_incr_top, lua_lock, lua_unlock, setnvalue, and lua_State::top.

void lua_pushstring | ( | lua_State * | L,
|  | const char * | s |
| ) |  |  |

Definition at line 450 of file lapi.c.

References lua_pushlstring(), and lua_pushnil().

int lua_pushthread | ( | lua_State * | L | ) |

Definition at line 515 of file lapi.c.

References api_incr_top, G, lua_lock, lua_unlock, setthvalue, and lua_State::top.

void lua_pushvalue | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 224 of file lapi.c.

References api_incr_top, index2adr(), lua_lock, lua_unlock, setobj2s, and lua_State::top.

const char* lua_pushvfstring | ( | lua_State * | L,
|  | const char * | fmt,
|  | va_list | argp |
| ) |  |  |

Definition at line 458 of file lapi.c.

References lua_lock, lua_unlock, luaC_checkGC, and luaO_pushvfstring().

int lua_rawequal | ( | lua_State * | L,
|  | int | index1,
|  | int | index2 |
| ) |  |  |

Definition at line 275 of file lapi.c.

References index2adr(), luaO_nilobject, and luaO_rawequalObj().

void lua_rawget | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 553 of file lapi.c.

References api_check, hvalue, index2adr(), lua_lock, lua_unlock, luaH_get(), setobj2s, lua_State::top, and ttistable.

void lua_rawgeti | ( | lua_State * | L,
|  | int | idx,
|  | int | n |
| ) |  |  |

Definition at line 563 of file lapi.c.

References api_check, api_incr_top, hvalue, index2adr(), lua_lock, lua_unlock, luaH_getnum(), setobj2s, lua_State::top, and ttistable.

void lua_rawset | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 667 of file lapi.c.

References api_check, api_checknelems, hvalue, index2adr(), lua_lock, lua_unlock, luaC_barriert, luaH_set(), setobj2t, lua_State::top, and ttistable.

void lua_rawseti | ( | lua_State * | L,
|  | int | idx,
|  | int | n |
| ) |  |  |

Definition at line 680 of file lapi.c.

References api_check, api_checknelems, hvalue, index2adr(), lua_lock, lua_unlock, luaC_barriert, luaH_setnum(), setobj2t, lua_State::top, and ttistable.

void lua_remove | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 176 of file lapi.c.

References api_checkvalidindex, index2adr(), lua_lock, lua_unlock, setobjs2s, and lua_State::top.

void lua_replace | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 199 of file lapi.c.

References api_check, api_checknelems, api_checkvalidindex, lua_State::base_ci, Closure::c, lua_State::ci, curr_func, CClosure::env, hvalue, index2adr(), lua_lock, lua_unlock, luaC_barrier, luaG_runerror(), setobj, lua_State::top, and ttistable.

void lua_setallocf | ( | lua_State * | L,
|  | lua_Alloc | f,
|  | void * | ud |
| ) |  |  |

Definition at line 1010 of file lapi.c.

References G, lua_lock, and lua_unlock.

int lua_setfenv | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 730 of file lapi.c.

References api_check, api_checknelems, api_checkvalidindex, clvalue, gcvalue, gt, hvalue, index2adr(), lua_lock, lua_unlock, luaC_objbarrier, sethvalue, thvalue, lua_State::top, ttistable, ttype, and uvalue.

void lua_setfield | ( | lua_State * | L,
|  | int | idx,
|  | const char * | k |
| ) |  |  |

Definition at line 653 of file lapi.c.

References api_checknelems, api_checkvalidindex, index2adr(), lua_lock, lua_unlock, luaS_new, luaV_settable(), setsvalue, and lua_State::top.

int lua_setmetatable | ( | lua_State * | L,
|  | int | objindex |
| ) |  |  |

Definition at line 693 of file lapi.c.

References api_check, api_checknelems, api_checkvalidindex, G, hvalue, index2adr(), lua_lock, lua_unlock, luaC_objbarrier, luaC_objbarriert, rawuvalue, lua_State::top, ttisnil, ttistable, ttype, and uvalue.

void lua_settable | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 641 of file lapi.c.

References api_checknelems, api_checkvalidindex, index2adr(), lua_lock, lua_unlock, luaV_settable(), and lua_State::top.

void lua_settop | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 160 of file lapi.c.

References api_check, lua_State::base, lua_lock, lua_unlock, setnilvalue, and lua_State::top.

const char* lua_setupvalue | ( | lua_State * | L,
|  | int | funcindex,
|  | int | n |
| ) |  |  |

Definition at line 1064 of file lapi.c.

References api_checknelems, aux_upvalue(), clvalue, index2adr(), lua_lock, lua_unlock, luaC_barrier, setobj, and lua_State::top.

int lua_status | ( | lua_State * | L | ) |

Definition at line 886 of file lapi.c.

References lua_State::status.

int lua_toboolean | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 333 of file lapi.c.

References index2adr(), and l_isfalse.

lua_CFunction lua_tocfunction | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 375 of file lapi.c.

References clvalue, index2adr(), and iscfunction.

lua_Integer lua_tointeger | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 319 of file lapi.c.

References index2adr(), nvalue, and tonumber.

const char* lua_tolstring | ( | lua_State * | L,
|  | int | idx,
|  | size_t * | len |
| ) |  |  |

Definition at line 339 of file lapi.c.

References index2adr(), lua_lock, lua_unlock, luaC_checkGC, luaV_tostring(), svalue, tsvalue, and ttisstring.

lua_Number lua_tonumber | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 309 of file lapi.c.

References index2adr(), nvalue, and tonumber.

const void* lua_topointer | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 397 of file lapi.c.

References clvalue, hvalue, index2adr(), lua_touserdata(), thvalue, and ttype.

lua_State* lua_tothread | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 391 of file lapi.c.

References index2adr(), thvalue, and ttisthread.

void* lua_touserdata | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 381 of file lapi.c.

References index2adr(), pvalue, rawuvalue, and ttype.

Referenced by lua_topointer().

int lua_type | ( | lua_State * | L,
|  | int | idx |
| ) |  |  |

Definition at line 238 of file lapi.c.

References index2adr(), luaO_nilobject, and ttype.

Referenced by lua_isstring().

const char* lua_typename | ( | lua_State * | L,
|  | int | t |
| ) |  |  |

Definition at line 244 of file lapi.c.

References luaT_typenames, and UNUSED.

void lua_xmove | ( | lua_State * | from,
|  | lua_State * | to,
|  | int | n |
| ) |  |  |

Definition at line 111 of file lapi.c.

References api_check, api_checknelems, lua_State::ci, G, lua_lock, lua_unlock, setobj2s, lua_State::top, and CallInfo::top.

void luaA_pushobject | ( | lua_State * | L,
|  | const TValue * | o |
| ) |  |  |

Definition at line 89 of file lapi.c.

References api_incr_top, setobj2s, and lua_State::top.

Referenced by lua_getlocal().

## Variable Documentation

const char lua_ident[]

Initial value:

      "$Lua: "  "Lua 5.1.2"  " "  "Copyright (C) 1994-2007 Lua.org, PUC-Rio"  " $\n"
      "$Authors: "  "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"  " $\n"
      "$URL: www.lua.org $\n"

Definition at line 34 of file lapi.c.