lapi.c File Reference

Go to the source code of this file.

Classes

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 TValueindex2adr (lua_State *L, int idx)
static Tablegetcurrenv (lua_State *L)
void luaA_pushobject (lua_State *L, const TValue *o)
LUA_API int lua_checkstack (lua_State *L, int size)
LUA_API void lua_xmove (lua_State *from, lua_State *to, int n)
LUA_API void lua_setlevel (lua_State *from, lua_State *to)
LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf)
LUA_API lua_Statelua_newthread (lua_State *L)
LUA_API int lua_gettop (lua_State *L)
LUA_API void lua_settop (lua_State *L, int idx)
LUA_API void lua_remove (lua_State *L, int idx)
LUA_API void lua_insert (lua_State *L, int idx)
LUA_API void lua_replace (lua_State *L, int idx)
LUA_API void lua_pushvalue (lua_State *L, int idx)
LUA_API int lua_type (lua_State *L, int idx)
LUA_API const char * lua_typename (lua_State *L, int t)
LUA_API int lua_iscfunction (lua_State *L, int idx)
LUA_API int lua_isnumber (lua_State *L, int idx)
LUA_API int lua_isstring (lua_State *L, int idx)
LUA_API int lua_isuserdata (lua_State *L, int idx)
LUA_API int lua_rawequal (lua_State *L, int index1, int index2)
LUA_API int lua_equal (lua_State *L, int index1, int index2)
LUA_API int lua_lessthan (lua_State *L, int index1, int index2)
LUA_API lua_Number lua_tonumber (lua_State *L, int idx)
LUA_API lua_Integer lua_tointeger (lua_State *L, int idx)
LUA_API int lua_toboolean (lua_State *L, int idx)
LUA_API const char * lua_tolstring (lua_State *L, int idx, size_t *len)
LUA_API size_t lua_objlen (lua_State *L, int idx)
LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx)
LUA_API void * lua_touserdata (lua_State *L, int idx)
LUA_API lua_Statelua_tothread (lua_State *L, int idx)
LUA_API const void * lua_topointer (lua_State *L, int idx)
LUA_API void lua_pushnil (lua_State *L)
LUA_API void lua_pushnumber (lua_State *L, lua_Number n)
LUA_API void lua_pushinteger (lua_State *L, lua_Integer n)
LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len)
LUA_API void lua_pushstring (lua_State *L, const char *s)
LUA_API const char * lua_pushvfstring (lua_State *L, const char *fmt, va_list argp)
LUA_API const char * lua_pushfstring (lua_State *L, const char *fmt,...)
LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n)
LUA_API void lua_pushboolean (lua_State *L, int b)
LUA_API void lua_pushlightuserdata (lua_State *L, void *p)
LUA_API int lua_pushthread (lua_State *L)
LUA_API void lua_gettable (lua_State *L, int idx)
LUA_API void lua_getfield (lua_State *L, int idx, const char *k)
LUA_API void lua_rawget (lua_State *L, int idx)
LUA_API void lua_rawgeti (lua_State *L, int idx, int n)
LUA_API void lua_createtable (lua_State *L, int narray, int nrec)
LUA_API int lua_getmetatable (lua_State *L, int objindex)
LUA_API void lua_getfenv (lua_State *L, int idx)
LUA_API void lua_settable (lua_State *L, int idx)
LUA_API void lua_setfield (lua_State *L, int idx, const char *k)
LUA_API void lua_rawset (lua_State *L, int idx)
LUA_API void lua_rawseti (lua_State *L, int idx, int n)
LUA_API int lua_setmetatable (lua_State *L, int objindex)
LUA_API int lua_setfenv (lua_State *L, int idx)
LUA_API void lua_call (lua_State *L, int nargs, int nresults)
static void f_call (lua_State *L, void *ud)
LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc)
static void f_Ccall (lua_State *L, void *ud)
LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud)
LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, const char *chunkname)
LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data)
LUA_API int lua_status (lua_State *L)
LUA_API int lua_gc (lua_State *L, int what, int data)
LUA_API int lua_error (lua_State *L)
LUA_API int lua_next (lua_State *L, int idx)
LUA_API void lua_concat (lua_State *L, int n)
LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud)
LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud)
LUA_API void * lua_newuserdata (lua_State *L, size_t size)
static const char * aux_upvalue (StkId fi, int n, TValue **val)
LUA_API const char * lua_getupvalue (lua_State *L, int funcindex, int n)
LUA_API const char * lua_setupvalue (lua_State *L, int funcindex, int n)
LUA_API void * active_ctx (lua_State *L)
LUA_API void active_register (lua_State *L, void *ctx)

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 768 of file lapi.c.

Referenced by lua_call(), and lua_pcall().

#define api_checknelems ( L,
 )     api_check(L, (n) <= (L->top - L->base))
#define api_checkvalidindex ( L,
 )     api_check(L, (i) != luaO_nilobject)
#define api_incr_top (  )     {api_check(L, L->top < L->ci->top); L->top++;}
#define checkresults ( L,
na,
nr   )     api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)))

Definition at line 772 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

LUA_API void* active_ctx ( lua_State L  ) 

Definition at line 1089 of file lapi.c.

References lua_State::active_ctx.

LUA_API void active_register ( lua_State L,
void *  ctx 
)

Definition at line 1095 of file lapi.c.

References lua_State::active_ctx.

static const char* aux_upvalue ( StkId  fi,
int  n,
TValue **  val 
) [static]
static void f_call ( lua_State L,
void *  ud 
) [static]

Definition at line 798 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]
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, gt, and hvalue.

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

static TValue* index2adr ( lua_State L,
int  idx 
) [static]
LUA_API lua_CFunction lua_atpanic ( lua_State L,
lua_CFunction  panicf 
)

Definition at line 130 of file lapi.c.

References G, lua_lock, and lua_unlock.

Referenced by cl_lua_new(), and luaL_newstate().

LUA_API void lua_call ( lua_State L,
int  nargs,
int  nresults 
)
LUA_API int lua_checkstack ( lua_State L,
int  size 
)
LUA_API void lua_concat ( lua_State L,
int  n 
)
LUA_API int lua_cpcall ( lua_State L,
lua_CFunction  func,
void *  ud 
)

Definition at line 850 of file lapi.c.

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

Referenced by main().

LUA_API void lua_createtable ( lua_State L,
int  narray,
int  nrec 
)
LUA_API int lua_dump ( lua_State L,
lua_Writer  writer,
void *  data 
)

Definition at line 875 of file lapi.c.

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

Referenced by str_dump().

LUA_API int lua_equal ( lua_State L,
int  index1,
int  index2 
)

Definition at line 287 of file lapi.c.

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

LUA_API int lua_error ( lua_State L  ) 
LUA_API int lua_gc ( lua_State L,
int  what,
int  data 
)
LUA_API lua_Alloc lua_getallocf ( lua_State L,
void **  ud 
)

Definition at line 1007 of file lapi.c.

References f(), G, lua_lock, and lua_unlock.

LUA_API void lua_getfenv ( lua_State L,
int  idx 
)
LUA_API void lua_getfield ( lua_State L,
int  idx,
const char *  k 
)
LUA_API int lua_getmetatable ( lua_State L,
int  objindex 
)
LUA_API void lua_gettable ( lua_State L,
int  idx 
)

Definition at line 534 of file lapi.c.

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

Referenced by add_value(), and ll_register().

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

Definition at line 1057 of file lapi.c.

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

Referenced by auxupvalue().

LUA_API void lua_insert ( lua_State L,
int  idx 
)
LUA_API int lua_iscfunction ( lua_State L,
int  idx 
)

Definition at line 254 of file lapi.c.

References index2adr(), and iscfunction.

Referenced by auxupvalue(), luaB_cocreate(), luaB_getfenv(), luaB_setfenv(), and setfenv().

LUA_API int lua_isnumber ( lua_State L,
int  idx 
)
LUA_API int lua_isstring ( lua_State L,
int  idx 
)
LUA_API int lua_isuserdata ( lua_State L,
int  idx 
)

Definition at line 273 of file lapi.c.

References index2adr(), ttislightuserdata, and ttisuserdata.

Referenced by checkudata().

LUA_API int lua_lessthan ( lua_State L,
int  index1,
int  index2 
)

Definition at line 299 of file lapi.c.

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

Referenced by sort_comp().

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

Definition at line 862 of file lapi.c.

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

Referenced by luaB_load(), luaL_loadbuffer(), and luaL_loadfile().

LUA_API lua_State* lua_newthread ( lua_State L  ) 
LUA_API void* lua_newuserdata ( lua_State L,
size_t  size 
)
LUA_API int lua_next ( lua_State L,
int  idx 
)

Definition at line 973 of file lapi.c.

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

Referenced by foreach(), luaB_next(), and maxn().

LUA_API size_t lua_objlen ( lua_State L,
int  idx 
)
LUA_API int lua_pcall ( lua_State L,
int  nargs,
int  nresults,
int  errfunc 
)
LUA_API void lua_pushboolean ( lua_State L,
int  b 
)
LUA_API void lua_pushcclosure ( lua_State L,
lua_CFunction  fn,
int  n 
)
LUA_API const char* lua_pushfstring ( lua_State L,
const char *  fmt,
  ... 
)
LUA_API void lua_pushinteger ( lua_State L,
lua_Integer  n 
)
LUA_API void lua_pushlightuserdata ( lua_State L,
void *  p 
)
LUA_API void lua_pushlstring ( lua_State L,
const char *  s,
size_t  len 
)
LUA_API void lua_pushnil ( lua_State L  ) 
LUA_API void lua_pushnumber ( lua_State L,
lua_Number  n 
)
LUA_API void lua_pushstring ( lua_State L,
const char *  s 
)
LUA_API int lua_pushthread ( lua_State L  ) 

Definition at line 519 of file lapi.c.

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

Referenced by luaB_corunning(), and luaB_setfenv().

LUA_API void lua_pushvalue ( lua_State L,
int  idx 
)
LUA_API const char* lua_pushvfstring ( lua_State L,
const char *  fmt,
va_list  argp 
)

Definition at line 462 of file lapi.c.

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

Referenced by luaL_error().

LUA_API int lua_rawequal ( lua_State L,
int  index1,
int  index2 
)

Definition at line 279 of file lapi.c.

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

Referenced by io_type(), luaB_rawequal(), and luaL_checkudata().

LUA_API void lua_rawget ( lua_State L,
int  idx 
)
LUA_API void lua_rawgeti ( lua_State L,
int  idx,
int  n 
)
LUA_API void lua_rawset ( lua_State L,
int  idx 
)
LUA_API void lua_rawseti ( lua_State L,
int  idx,
int  n 
)
LUA_API void lua_remove ( lua_State L,
int  idx 
)
LUA_API void lua_replace ( lua_State L,
int  idx 
)
LUA_API void lua_setallocf ( lua_State L,
lua_Alloc  f,
void *  ud 
)

Definition at line 1017 of file lapi.c.

References G, lua_lock, and lua_unlock.

LUA_API int lua_setfenv ( lua_State L,
int  idx 
)
LUA_API void lua_setfield ( lua_State L,
int  idx,
const char *  k 
)
LUA_API void lua_setlevel ( lua_State from,
lua_State to 
)

Definition at line 125 of file lapi.c.

References lua_State::nCcalls.

Referenced by auxresume().

LUA_API int lua_setmetatable ( lua_State L,
int  objindex 
)
LUA_API void lua_settable ( lua_State L,
int  idx 
)
LUA_API void lua_settop ( lua_State L,
int  idx 
)
LUA_API const char* lua_setupvalue ( lua_State L,
int  funcindex,
int  n 
)

Definition at line 1071 of file lapi.c.

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

Referenced by auxupvalue().

LUA_API int lua_status ( lua_State L  ) 

Definition at line 890 of file lapi.c.

References lua_State::status.

Referenced by costatus().

LUA_API int lua_toboolean ( lua_State L,
int  idx 
)
LUA_API lua_CFunction lua_tocfunction ( lua_State L,
int  idx 
)

Definition at line 379 of file lapi.c.

References clvalue, index2adr(), and iscfunction.

Referenced by aux_close().

LUA_API lua_Integer lua_tointeger ( lua_State L,
int  idx 
)
LUA_API const char* lua_tolstring ( lua_State L,
int  idx,
size_t *  len 
)
LUA_API lua_Number lua_tonumber ( lua_State L,
int  idx 
)
LUA_API const void* lua_topointer ( lua_State L,
int  idx 
)
LUA_API lua_State* lua_tothread ( lua_State L,
int  idx 
)

Definition at line 395 of file lapi.c.

References index2adr(), thvalue, and ttisthread.

Referenced by getthread(), luaB_auxwrap(), luaB_coresume(), and luaB_costatus().

LUA_API void* lua_touserdata ( lua_State L,
int  idx 
)
LUA_API int lua_type ( lua_State L,
int  idx 
)
LUA_API const char* lua_typename ( lua_State L,
int  t 
)

Definition at line 248 of file lapi.c.

References LUA_TNONE, luaT_typenames, and UNUSED.

Referenced by tag_error().

LUA_API void lua_xmove ( lua_State from,
lua_State to,
int  n 
)
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_RELEASE " " LUA_COPYRIGHT " $\n"
  "$Authors: " LUA_AUTHORS " $\n"
  "$URL: www.lua.org $\n"

Definition at line 34 of file lapi.c.


ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:59 2011 by Doxygen 1.6.1