Classes | Macros | Functions | Variables
lapi.c File Reference
#include "lprefix.h"
#include <limits.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.

Classes

struct  CallS
 

Macros

#define checkresults(L, na, nr)
 
#define getGtable(L)   (&hvalue(&G(L)->l_registry)->array[LUA_RIDX_GLOBALS - 1])
 
#define ispseudo(i)   ((i) <= LUA_REGISTRYINDEX)
 
#define isupvalue(i)   ((i) < LUA_REGISTRYINDEX)
 
#define isvalid(L, o)   (!ttisnil(o) || o != &G(L)->nilvalue)
 
#define lapi_c
 
#define LUA_CORE
 

Functions

static void aux_rawset (lua_State *L, int idx, TValue *key, int n)
 
static const char * aux_upvalue (TValue *fi, int n, TValue **val, GCObject **owner)
 
static int auxgetstr (lua_State *L, const TValue *t, const char *k)
 
static void auxsetstr (lua_State *L, const TValue *t, const char *k)
 
static void f_call (lua_State *L, void *ud)
 
static int finishrawget (lua_State *L, const TValue *val)
 
static Tablegettable (lua_State *L, int idx)
 
static UpVal ** getupvalref (lua_State *L, int fidx, int n, LClosure **pf)
 
static StkId index2stack (lua_State *L, int idx)
 
static TValueindex2value (lua_State *L, int idx)
 
LUA_API int lua_absindex (lua_State *L, int idx)
 
LUA_API void lua_arith (lua_State *L, int op)
 
LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf)
 
LUA_API void lua_callk (lua_State *L, int nargs, int nresults, lua_KContext ctx, lua_KFunction k)
 
LUA_API int lua_checkstack (lua_State *L, int n)
 
LUA_API void lua_closeslot (lua_State *L, int idx)
 
LUA_API int lua_compare (lua_State *L, int index1, int index2, int op)
 
LUA_API void lua_concat (lua_State *L, int n)
 
LUA_API void lua_copy (lua_State *L, int fromidx, int toidx)
 
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, int strip)
 
LUA_API int lua_error (lua_State *L)
 
LUA_API int lua_gc (lua_State *L, int what,...)
 
LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud)
 
LUA_API int lua_getfield (lua_State *L, int idx, const char *k)
 
LUA_API int lua_getglobal (lua_State *L, const char *name)
 
LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n)
 
LUA_API int lua_getiuservalue (lua_State *L, int idx, int n)
 
LUA_API int lua_getmetatable (lua_State *L, int objindex)
 
LUA_API int lua_gettable (lua_State *L, int idx)
 
LUA_API int lua_gettop (lua_State *L)
 
const LUA_API char * lua_getupvalue (lua_State *L, int funcindex, int n)
 
LUA_API int lua_iscfunction (lua_State *L, int idx)
 
LUA_API int lua_isinteger (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 void lua_len (lua_State *L, int idx)
 
LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, const char *chunkname, const char *mode)
 
LUA_API void * lua_newuserdatauv (lua_State *L, size_t size, int nuvalue)
 
LUA_API int lua_next (lua_State *L, int idx)
 
LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, lua_KContext ctx, lua_KFunction k)
 
LUA_API void lua_pushboolean (lua_State *L, int b)
 
LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n)
 
const LUA_API 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)
 
const LUA_API char * 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)
 
const LUA_API char * lua_pushstring (lua_State *L, const char *s)
 
LUA_API int lua_pushthread (lua_State *L)
 
LUA_API void lua_pushvalue (lua_State *L, int idx)
 
const LUA_API char * lua_pushvfstring (lua_State *L, const char *fmt, va_list argp)
 
LUA_API int lua_rawequal (lua_State *L, int index1, int index2)
 
LUA_API int lua_rawget (lua_State *L, int idx)
 
LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n)
 
LUA_API int lua_rawgetp (lua_State *L, int idx, const void *p)
 
LUA_API lua_Unsigned lua_rawlen (lua_State *L, int idx)
 
LUA_API void lua_rawset (lua_State *L, int idx)
 
LUA_API void lua_rawseti (lua_State *L, int idx, lua_Integer n)
 
LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p)
 
LUA_API void lua_rotate (lua_State *L, int idx, int n)
 
LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud)
 
LUA_API void lua_setfield (lua_State *L, int idx, const char *k)
 
LUA_API void lua_setglobal (lua_State *L, const char *name)
 
LUA_API void lua_seti (lua_State *L, int idx, lua_Integer n)
 
LUA_API int lua_setiuservalue (lua_State *L, int idx, int n)
 
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)
 
const LUA_API char * lua_setupvalue (lua_State *L, int funcindex, int n)
 
void lua_setwarnf (lua_State *L, lua_WarnFunction f, void *ud)
 
LUA_API int lua_status (lua_State *L)
 
LUA_API size_t lua_stringtonumber (lua_State *L, const char *s)
 
LUA_API int lua_toboolean (lua_State *L, int idx)
 
LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx)
 
LUA_API void lua_toclose (lua_State *L, int idx)
 
LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *pisnum)
 
const LUA_API char * lua_tolstring (lua_State *L, int idx, size_t *len)
 
LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *pisnum)
 
const LUA_API void * lua_topointer (lua_State *L, int idx)
 
LUA_API lua_Statelua_tothread (lua_State *L, int idx)
 
LUA_API void * lua_touserdata (lua_State *L, int idx)
 
LUA_API int lua_type (lua_State *L, int idx)
 
const LUA_API char * lua_typename (lua_State *L, int t)
 
LUA_API void * lua_upvalueid (lua_State *L, int fidx, int n)
 
LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, int fidx2, int n2)
 
LUA_API lua_Number lua_version (lua_State *L)
 
void lua_warning (lua_State *L, const char *msg, int tocont)
 
LUA_API void lua_xmove (lua_State *from, lua_State *to, int n)
 
static void reverse (lua_State *L, StkId from, StkId to)
 
static void * touserdata (const TValue *o)
 

Variables

const char lua_ident []
 

Macro Definition Documentation

◆ checkresults

#define checkresults (   L,
  na,
  nr 
)
Value:
api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)), \
"results from function overflow current stack size")

Definition at line 992 of file lapi.c.

◆ getGtable

#define getGtable (   L)    (&hvalue(&G(L)->l_registry)->array[LUA_RIDX_GLOBALS - 1])

Definition at line 656 of file lapi.c.

◆ ispseudo

#define ispseudo (   i)    ((i) <= LUA_REGISTRYINDEX)

Definition at line 50 of file lapi.c.

◆ isupvalue

#define isupvalue (   i)    ((i) < LUA_REGISTRYINDEX)

Definition at line 53 of file lapi.c.

◆ isvalid

#define isvalid (   L,
 
)    (!ttisnil(o) || o != &G(L)->nilvalue)

Definition at line 46 of file lapi.c.

◆ lapi_c

#define lapi_c

Definition at line 7 of file lapi.c.

◆ LUA_CORE

#define LUA_CORE

Definition at line 8 of file lapi.c.

Function Documentation

◆ aux_rawset()

static void aux_rawset ( lua_State L,
int  idx,
TValue key,
int  n 
)
static

Definition at line 890 of file lapi.c.

◆ aux_upvalue()

static const char* aux_upvalue ( TValue fi,
int  n,
TValue **  val,
GCObject **  owner 
)
static

Definition at line 1349 of file lapi.c.

◆ auxgetstr()

static int auxgetstr ( lua_State L,
const TValue t,
const char *  k 
)
static

Definition at line 633 of file lapi.c.

◆ auxsetstr()

static void auxsetstr ( lua_State L,
const TValue t,
const char *  k 
)
static

Definition at line 823 of file lapi.c.

◆ f_call()

static void f_call ( lua_State L,
void *  ud 
)
static

Definition at line 1029 of file lapi.c.

◆ finishrawget()

static int finishrawget ( lua_State L,
const TValue val 
)
static

Definition at line 708 of file lapi.c.

◆ gettable()

static Table* gettable ( lua_State L,
int  idx 
)
static

Definition at line 719 of file lapi.c.

◆ getupvalref()

static UpVal** getupvalref ( lua_State L,
int  fidx,
int  n,
LClosure **  pf 
)
static

Definition at line 1409 of file lapi.c.

◆ index2stack()

static StkId index2stack ( lua_State L,
int  idx 
)
static

Definition at line 84 of file lapi.c.

◆ index2value()

static TValue* index2value ( lua_State L,
int  idx 
)
static

Definition at line 56 of file lapi.c.

◆ lua_absindex()

LUA_API int lua_absindex ( lua_State L,
int  idx 
)

Definition at line 162 of file lapi.c.

◆ lua_arith()

LUA_API void lua_arith ( lua_State L,
int  op 
)

Definition at line 329 of file lapi.c.

◆ lua_atpanic()

LUA_API lua_CFunction lua_atpanic ( lua_State L,
lua_CFunction  panicf 
)

Definition at line 137 of file lapi.c.

◆ lua_callk()

LUA_API void lua_callk ( lua_State L,
int  nargs,
int  nresults,
lua_KContext  ctx,
lua_KFunction  k 
)

Definition at line 997 of file lapi.c.

◆ lua_checkstack()

LUA_API int lua_checkstack ( lua_State L,
int  n 
)

Definition at line 99 of file lapi.c.

◆ lua_closeslot()

LUA_API void lua_closeslot ( lua_State L,
int  idx 
)

Definition at line 202 of file lapi.c.

◆ lua_compare()

LUA_API int lua_compare ( lua_State L,
int  index1,
int  index2,
int  op 
)

Definition at line 345 of file lapi.c.

◆ lua_concat()

LUA_API void lua_concat ( lua_State L,
int  n 
)

Definition at line 1277 of file lapi.c.

◆ lua_copy()

LUA_API void lua_copy ( lua_State L,
int  fromidx,
int  toidx 
)

Definition at line 249 of file lapi.c.

◆ lua_createtable()

LUA_API void lua_createtable ( lua_State L,
int  narray,
int  nrec 
)

Definition at line 756 of file lapi.c.

◆ lua_dump()

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

Definition at line 1103 of file lapi.c.

◆ lua_error()

LUA_API int lua_error ( lua_State L)

Definition at line 1230 of file lapi.c.

◆ lua_gc()

LUA_API int lua_gc ( lua_State L,
int  what,
  ... 
)

Definition at line 1126 of file lapi.c.

◆ lua_getallocf()

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

Definition at line 1301 of file lapi.c.

◆ lua_getfield()

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

Definition at line 683 of file lapi.c.

◆ lua_getglobal()

LUA_API int lua_getglobal ( lua_State L,
const char *  name 
)

Definition at line 660 of file lapi.c.

◆ lua_geti()

LUA_API int lua_geti ( lua_State L,
int  idx,
lua_Integer  n 
)

Definition at line 689 of file lapi.c.

◆ lua_getiuservalue()

LUA_API int lua_getiuservalue ( lua_State L,
int  idx,
int  n 
)

Definition at line 796 of file lapi.c.

◆ lua_getmetatable()

LUA_API int lua_getmetatable ( lua_State L,
int  objindex 
)

Definition at line 769 of file lapi.c.

◆ lua_gettable()

LUA_API int lua_gettable ( lua_State L,
int  idx 
)

Definition at line 668 of file lapi.c.

◆ lua_gettop()

LUA_API int lua_gettop ( lua_State L)

Definition at line 169 of file lapi.c.

◆ lua_getupvalue()

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

Definition at line 1376 of file lapi.c.

◆ lua_iscfunction()

LUA_API int lua_iscfunction ( lua_State L,
int  idx 
)

Definition at line 291 of file lapi.c.

◆ lua_isinteger()

LUA_API int lua_isinteger ( lua_State L,
int  idx 
)

Definition at line 297 of file lapi.c.

◆ lua_isnumber()

LUA_API int lua_isnumber ( lua_State L,
int  idx 
)

Definition at line 303 of file lapi.c.

◆ lua_isstring()

LUA_API int lua_isstring ( lua_State L,
int  idx 
)

Definition at line 310 of file lapi.c.

◆ lua_isuserdata()

LUA_API int lua_isuserdata ( lua_State L,
int  idx 
)

Definition at line 316 of file lapi.c.

◆ lua_len()

LUA_API void lua_len ( lua_State L,
int  idx 
)

Definition at line 1291 of file lapi.c.

◆ lua_load()

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

Definition at line 1080 of file lapi.c.

◆ lua_newuserdatauv()

LUA_API void* lua_newuserdatauv ( lua_State L,
size_t  size,
int  nuvalue 
)

Definition at line 1335 of file lapi.c.

◆ lua_next()

LUA_API int lua_next ( lua_State L,
int  idx 
)

Definition at line 1245 of file lapi.c.

◆ lua_pcallk()

LUA_API int lua_pcallk ( lua_State L,
int  nargs,
int  nresults,
int  errfunc,
lua_KContext  ctx,
lua_KFunction  k 
)

Definition at line 1036 of file lapi.c.

◆ lua_pushboolean()

LUA_API void lua_pushboolean ( lua_State L,
int  b 
)

Definition at line 599 of file lapi.c.

◆ lua_pushcclosure()

LUA_API void lua_pushcclosure ( lua_State L,
lua_CFunction  fn,
int  n 
)

Definition at line 573 of file lapi.c.

◆ lua_pushfstring()

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

Definition at line 560 of file lapi.c.

◆ lua_pushinteger()

LUA_API void lua_pushinteger ( lua_State L,
lua_Integer  n 
)

Definition at line 507 of file lapi.c.

◆ lua_pushlightuserdata()

LUA_API void lua_pushlightuserdata ( lua_State L,
void *  p 
)

Definition at line 610 of file lapi.c.

◆ lua_pushlstring()

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

Definition at line 520 of file lapi.c.

◆ lua_pushnil()

LUA_API void lua_pushnil ( lua_State L)

Definition at line 491 of file lapi.c.

◆ lua_pushnumber()

LUA_API void lua_pushnumber ( lua_State L,
lua_Number  n 
)

Definition at line 499 of file lapi.c.

◆ lua_pushstring()

const LUA_API char* lua_pushstring ( lua_State L,
const char *  s 
)

Definition at line 532 of file lapi.c.

◆ lua_pushthread()

LUA_API int lua_pushthread ( lua_State L)

Definition at line 618 of file lapi.c.

◆ lua_pushvalue()

LUA_API void lua_pushvalue ( lua_State L,
int  idx 
)

Definition at line 264 of file lapi.c.

◆ lua_pushvfstring()

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

Definition at line 549 of file lapi.c.

◆ lua_rawequal()

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

Definition at line 322 of file lapi.c.

◆ lua_rawget()

LUA_API int lua_rawget ( lua_State L,
int  idx 
)

Definition at line 726 of file lapi.c.

◆ lua_rawgeti()

LUA_API int lua_rawgeti ( lua_State L,
int  idx,
lua_Integer  n 
)

Definition at line 738 of file lapi.c.

◆ lua_rawgetp()

LUA_API int lua_rawgetp ( lua_State L,
int  idx,
const void *  p 
)

Definition at line 746 of file lapi.c.

◆ lua_rawlen()

LUA_API lua_Unsigned lua_rawlen ( lua_State L,
int  idx 
)

Definition at line 420 of file lapi.c.

◆ lua_rawset()

LUA_API void lua_rawset ( lua_State L,
int  idx 
)

Definition at line 903 of file lapi.c.

◆ lua_rawseti()

LUA_API void lua_rawseti ( lua_State L,
int  idx,
lua_Integer  n 
)

Definition at line 915 of file lapi.c.

◆ lua_rawsetp()

LUA_API void lua_rawsetp ( lua_State L,
int  idx,
const void *  p 
)

Definition at line 908 of file lapi.c.

◆ lua_rotate()

LUA_API void lua_rotate ( lua_State L,
int  idx,
int  n 
)

Definition at line 235 of file lapi.c.

◆ lua_setallocf()

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

Definition at line 1311 of file lapi.c.

◆ lua_setfield()

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

Definition at line 865 of file lapi.c.

◆ lua_setglobal()

LUA_API void lua_setglobal ( lua_State L,
const char *  name 
)

Definition at line 841 of file lapi.c.

◆ lua_seti()

LUA_API void lua_seti ( lua_State L,
int  idx,
lua_Integer  n 
)

Definition at line 871 of file lapi.c.

◆ lua_setiuservalue()

LUA_API int lua_setiuservalue ( lua_State L,
int  idx,
int  n 
)

Definition at line 967 of file lapi.c.

◆ lua_setmetatable()

LUA_API int lua_setmetatable ( lua_State L,
int  objindex 
)

Definition at line 927 of file lapi.c.

◆ lua_settable()

LUA_API void lua_settable ( lua_State L,
int  idx 
)

Definition at line 849 of file lapi.c.

◆ lua_settop()

LUA_API void lua_settop ( lua_State L,
int  idx 
)

Definition at line 174 of file lapi.c.

◆ lua_setupvalue()

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

Definition at line 1390 of file lapi.c.

◆ lua_setwarnf()

void lua_setwarnf ( lua_State L,
lua_WarnFunction  f,
void *  ud 
)

Definition at line 1319 of file lapi.c.

◆ lua_status()

LUA_API int lua_status ( lua_State L)

Definition at line 1118 of file lapi.c.

◆ lua_stringtonumber()

LUA_API size_t lua_stringtonumber ( lua_State L,
const char *  s 
)

Definition at line 365 of file lapi.c.

◆ lua_toboolean()

LUA_API int lua_toboolean ( lua_State L,
int  idx 
)

Definition at line 393 of file lapi.c.

◆ lua_tocfunction()

LUA_API lua_CFunction lua_tocfunction ( lua_State L,
int  idx 
)

Definition at line 432 of file lapi.c.

◆ lua_toclose()

LUA_API void lua_toclose ( lua_State L,
int  idx 
)

Definition at line 1262 of file lapi.c.

◆ lua_tointegerx()

LUA_API lua_Integer lua_tointegerx ( lua_State L,
int  idx,
int *  pisnum 
)

Definition at line 383 of file lapi.c.

◆ lua_tolstring()

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

Definition at line 399 of file lapi.c.

◆ lua_tonumberx()

LUA_API lua_Number lua_tonumberx ( lua_State L,
int  idx,
int *  pisnum 
)

Definition at line 373 of file lapi.c.

◆ lua_topointer()

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

Definition at line 469 of file lapi.c.

◆ lua_tothread()

LUA_API lua_State* lua_tothread ( lua_State L,
int  idx 
)

Definition at line 456 of file lapi.c.

◆ lua_touserdata()

LUA_API void* lua_touserdata ( lua_State L,
int  idx 
)

Definition at line 450 of file lapi.c.

◆ lua_type()

LUA_API int lua_type ( lua_State L,
int  idx 
)

Definition at line 278 of file lapi.c.

◆ lua_typename()

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

Definition at line 284 of file lapi.c.

◆ lua_upvalueid()

LUA_API void* lua_upvalueid ( lua_State L,
int  fidx,
int  n 
)

Definition at line 1423 of file lapi.c.

◆ lua_upvaluejoin()

LUA_API void lua_upvaluejoin ( lua_State L,
int  fidx1,
int  n1,
int  fidx2,
int  n2 
)

Definition at line 1445 of file lapi.c.

◆ lua_version()

LUA_API lua_Number lua_version ( lua_State L)

Definition at line 147 of file lapi.c.

◆ lua_warning()

void lua_warning ( lua_State L,
const char *  msg,
int  tocont 
)

Definition at line 1327 of file lapi.c.

◆ lua_xmove()

LUA_API void lua_xmove ( lua_State from,
lua_State to,
int  n 
)

Definition at line 121 of file lapi.c.

◆ reverse()

static void reverse ( lua_State L,
StkId  from,
StkId  to 
)
static

Definition at line 221 of file lapi.c.

◆ touserdata()

static void* touserdata ( const TValue o)
static

Definition at line 441 of file lapi.c.

Variable Documentation

◆ lua_ident

const char lua_ident[]
Initial value:
=
"$LuaVersion: " LUA_COPYRIGHT " $"
"$LuaAuthors: " LUA_AUTHORS " $"

Definition at line 35 of file lapi.c.

LUA_MULTRET
#define LUA_MULTRET
Definition: lua.h:36
LUA_COPYRIGHT
#define LUA_COPYRIGHT
Definition: lua.h:28
api_check
#define api_check(l, e, msg)
Definition: llimits.h:113
LUA_AUTHORS
#define LUA_AUTHORS
Definition: lua.h:29


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:49