Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
lua.h File Reference
#include <stdarg.h>
#include <stddef.h>
#include "luaconf.h"

Go to the source code of this file.

Data Structures

struct  lua_Debug
 

Macros

#define LUA_VERSION_MAJOR   "5"
 
#define LUA_VERSION_MINOR   "4"
 
#define LUA_VERSION_RELEASE   "3"
 
#define LUA_VERSION_NUM   504
 
#define LUA_VERSION_RELEASE_NUM   (LUA_VERSION_NUM * 100 + 0)
 
#define LUA_VERSION   "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
 
#define LUA_RELEASE   LUA_VERSION "." LUA_VERSION_RELEASE
 
#define LUA_COPYRIGHT   LUA_RELEASE " Copyright (C) 1994-2021 Lua.org, PUC-Rio"
 
#define LUA_AUTHORS   "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
 
#define LUA_SIGNATURE   "\x1bLua"
 
#define LUA_MULTRET   (-1)
 
#define LUA_REGISTRYINDEX   (-LUAI_MAXSTACK - 1000)
 
#define lua_upvalueindex(i)   (LUA_REGISTRYINDEX - (i))
 
#define LUA_OK   0
 
#define LUA_YIELD   1
 
#define LUA_ERRRUN   2
 
#define LUA_ERRSYNTAX   3
 
#define LUA_ERRMEM   4
 
#define LUA_ERRERR   5
 
#define LUA_TNONE   (-1)
 
#define LUA_TNIL   0
 
#define LUA_TBOOLEAN   1
 
#define LUA_TLIGHTUSERDATA   2
 
#define LUA_TNUMBER   3
 
#define LUA_TSTRING   4
 
#define LUA_TTABLE   5
 
#define LUA_TFUNCTION   6
 
#define LUA_TUSERDATA   7
 
#define LUA_TTHREAD   8
 
#define LUA_NUMTYPES   9
 
#define LUA_MINSTACK   20
 
#define LUA_RIDX_MAINTHREAD   1
 
#define LUA_RIDX_GLOBALS   2
 
#define LUA_RIDX_LAST   LUA_RIDX_GLOBALS
 
#define LUA_OPADD   0 /* ORDER TM, ORDER OP */
 
#define LUA_OPSUB   1
 
#define LUA_OPMUL   2
 
#define LUA_OPMOD   3
 
#define LUA_OPPOW   4
 
#define LUA_OPDIV   5
 
#define LUA_OPIDIV   6
 
#define LUA_OPBAND   7
 
#define LUA_OPBOR   8
 
#define LUA_OPBXOR   9
 
#define LUA_OPSHL   10
 
#define LUA_OPSHR   11
 
#define LUA_OPUNM   12
 
#define LUA_OPBNOT   13
 
#define LUA_OPEQ   0
 
#define LUA_OPLT   1
 
#define LUA_OPLE   2
 
#define lua_call(L, n, r)   lua_callk(L, (n), (r), 0, NULL)
 
#define lua_pcall(L, n, r, f)   lua_pcallk(L, (n), (r), (f), 0, NULL)
 
#define lua_yield(L, n)   lua_yieldk(L, (n), 0, NULL)
 
#define LUA_GCSTOP   0
 
#define LUA_GCRESTART   1
 
#define LUA_GCCOLLECT   2
 
#define LUA_GCCOUNT   3
 
#define LUA_GCCOUNTB   4
 
#define LUA_GCSTEP   5
 
#define LUA_GCSETPAUSE   6
 
#define LUA_GCSETSTEPMUL   7
 
#define LUA_GCISRUNNING   9
 
#define LUA_GCGEN   10
 
#define LUA_GCINC   11
 
#define lua_getextraspace(L)   ((void *)((char *)(L) - LUA_EXTRASPACE))
 
#define lua_tonumber(L, i)   lua_tonumberx(L,(i),NULL)
 
#define lua_tointeger(L, i)   lua_tointegerx(L,(i),NULL)
 
#define lua_pop(L, n)   lua_settop(L, -(n)-1)
 
#define lua_newtable(L)   lua_createtable(L, 0, 0)
 
#define lua_register(L, n, f)   (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))
 
#define lua_pushcfunction(L, f)   lua_pushcclosure(L, (f), 0)
 
#define lua_isfunction(L, n)   (lua_type(L, (n)) == LUA_TFUNCTION)
 
#define lua_istable(L, n)   (lua_type(L, (n)) == LUA_TTABLE)
 
#define lua_islightuserdata(L, n)   (lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
 
#define lua_isnil(L, n)   (lua_type(L, (n)) == LUA_TNIL)
 
#define lua_isboolean(L, n)   (lua_type(L, (n)) == LUA_TBOOLEAN)
 
#define lua_isthread(L, n)   (lua_type(L, (n)) == LUA_TTHREAD)
 
#define lua_isnone(L, n)   (lua_type(L, (n)) == LUA_TNONE)
 
#define lua_isnoneornil(L, n)   (lua_type(L, (n)) <= 0)
 
#define lua_pushliteral(L, s)   lua_pushstring(L, "" s)
 
#define lua_pushglobaltable(L)    ((void)lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS))
 
#define lua_tostring(L, i)   lua_tolstring(L, (i), NULL)
 
#define lua_insert(L, idx)   lua_rotate(L, (idx), 1)
 
#define lua_remove(L, idx)   (lua_rotate(L, (idx), -1), lua_pop(L, 1))
 
#define lua_replace(L, idx)   (lua_copy(L, -1, (idx)), lua_pop(L, 1))
 
#define lua_newuserdata(L, s)   lua_newuserdatauv(L,s,1)
 
#define lua_getuservalue(L, idx)   lua_getiuservalue(L,idx,1)
 
#define lua_setuservalue(L, idx)   lua_setiuservalue(L,idx,1)
 
#define LUA_NUMTAGS   LUA_NUMTYPES
 
#define LUA_HOOKCALL   0
 
#define LUA_HOOKRET   1
 
#define LUA_HOOKLINE   2
 
#define LUA_HOOKCOUNT   3
 
#define LUA_HOOKTAILCALL   4
 
#define LUA_MASKCALL   (1 << LUA_HOOKCALL)
 
#define LUA_MASKRET   (1 << LUA_HOOKRET)
 
#define LUA_MASKLINE   (1 << LUA_HOOKLINE)
 
#define LUA_MASKCOUNT   (1 << LUA_HOOKCOUNT)
 

Typedefs

typedef struct lua_State lua_State
 
typedef LUA_NUMBER lua_Number
 
typedef LUA_INTEGER lua_Integer
 
typedef LUA_UNSIGNED lua_Unsigned
 
typedef LUA_KCONTEXT lua_KContext
 
typedef int(* lua_CFunction) (lua_State *L)
 
typedef int(* lua_KFunction) (lua_State *L, int status, lua_KContext ctx)
 
typedef const char *(* lua_Reader) (lua_State *L, void *ud, size_t *sz)
 
typedef int(* lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud)
 
typedef void *(* lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize)
 
typedef void(* lua_WarnFunction) (void *ud, const char *msg, int tocont)
 
typedef struct lua_Debug lua_Debug
 
typedef void(* lua_Hook) (lua_State *L, lua_Debug *ar)
 

Functions

LUA_API lua_Statelua_newstate (lua_Alloc f, void *ud)
 
LUA_API void lua_close (lua_State *L)
 
LUA_API lua_Statelua_newthread (lua_State *L)
 
LUA_API int lua_resetthread (lua_State *L)
 
LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf)
 
LUA_API lua_Number lua_version (lua_State *L)
 
LUA_API int lua_absindex (lua_State *L, int idx)
 
LUA_API int lua_gettop (lua_State *L)
 
LUA_API void lua_settop (lua_State *L, int idx)
 
LUA_API void lua_pushvalue (lua_State *L, int idx)
 
LUA_API void lua_rotate (lua_State *L, int idx, int n)
 
LUA_API void lua_copy (lua_State *L, int fromidx, int toidx)
 
LUA_API int lua_checkstack (lua_State *L, int n)
 
LUA_API void lua_xmove (lua_State *from, lua_State *to, int n)
 
LUA_API int lua_isnumber (lua_State *L, int idx)
 
LUA_API int lua_isstring (lua_State *L, int idx)
 
LUA_API int lua_iscfunction (lua_State *L, int idx)
 
LUA_API int lua_isinteger (lua_State *L, int idx)
 
LUA_API int lua_isuserdata (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 tp)
 
LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *isnum)
 
LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *isnum)
 
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 lua_Unsigned lua_rawlen (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_arith (lua_State *L, int op)
 
LUA_API int lua_rawequal (lua_State *L, int idx1, int idx2)
 
LUA_API int lua_compare (lua_State *L, int idx1, int idx2, int op)
 
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 const char * lua_pushlstring (lua_State *L, const char *s, size_t len)
 
LUA_API const char * 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 int lua_getglobal (lua_State *L, const char *name)
 
LUA_API int lua_gettable (lua_State *L, int idx)
 
LUA_API int lua_getfield (lua_State *L, int idx, const char *k)
 
LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n)
 
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 void lua_createtable (lua_State *L, int narr, int nrec)
 
LUA_API void * lua_newuserdatauv (lua_State *L, size_t sz, int nuvalue)
 
LUA_API int lua_getmetatable (lua_State *L, int objindex)
 
LUA_API int lua_getiuservalue (lua_State *L, int idx, int n)
 
LUA_API void lua_setglobal (lua_State *L, const char *name)
 
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_seti (lua_State *L, int idx, lua_Integer n)
 
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 int lua_setmetatable (lua_State *L, int objindex)
 
LUA_API int lua_setiuservalue (lua_State *L, int idx, int n)
 
LUA_API void lua_callk (lua_State *L, int nargs, int nresults, lua_KContext ctx, lua_KFunction k)
 
LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, lua_KContext ctx, lua_KFunction k)
 
LUA_API int lua_load (lua_State *L, lua_Reader reader, void *dt, const char *chunkname, const char *mode)
 
LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip)
 
LUA_API int lua_yieldk (lua_State *L, int nresults, lua_KContext ctx, lua_KFunction k)
 
LUA_API int lua_resume (lua_State *L, lua_State *from, int narg, int *nres)
 
LUA_API int lua_status (lua_State *L)
 
LUA_API int lua_isyieldable (lua_State *L)
 
LUA_API void lua_setwarnf (lua_State *L, lua_WarnFunction f, void *ud)
 
LUA_API void lua_warning (lua_State *L, const char *msg, int tocont)
 
LUA_API int lua_gc (lua_State *L, int what,...)
 
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 void lua_len (lua_State *L, int idx)
 
LUA_API size_t lua_stringtonumber (lua_State *L, const char *s)
 
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_toclose (lua_State *L, int idx)
 
LUA_API void lua_closeslot (lua_State *L, int idx)
 
LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar)
 
LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar)
 
LUA_API const char * lua_getlocal (lua_State *L, const lua_Debug *ar, int n)
 
LUA_API const char * lua_setlocal (lua_State *L, const lua_Debug *ar, int n)
 
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 * 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 void lua_sethook (lua_State *L, lua_Hook func, int mask, int count)
 
LUA_API lua_Hook lua_gethook (lua_State *L)
 
LUA_API int lua_gethookmask (lua_State *L)
 
LUA_API int lua_gethookcount (lua_State *L)
 
LUA_API int lua_setcstacklimit (lua_State *L, unsigned int limit)
 

Variables

const char lua_ident []
 

Macro Definition Documentation

◆ LUA_AUTHORS

#define LUA_AUTHORS   "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"

Definition at line 29 of file lua-5.4.3/src/lua.h.

◆ lua_call

#define lua_call ( L,
n,
r )   lua_callk(L, (n), (r), 0, NULL)

Definition at line 283 of file lua-5.4.3/src/lua.h.

◆ LUA_COPYRIGHT

#define LUA_COPYRIGHT   LUA_RELEASE " Copyright (C) 1994-2021 Lua.org, PUC-Rio"

Definition at line 28 of file lua-5.4.3/src/lua.h.

◆ LUA_ERRERR

#define LUA_ERRERR   5

Definition at line 54 of file lua-5.4.3/src/lua.h.

◆ LUA_ERRMEM

#define LUA_ERRMEM   4

Definition at line 53 of file lua-5.4.3/src/lua.h.

◆ LUA_ERRRUN

#define LUA_ERRRUN   2

Definition at line 51 of file lua-5.4.3/src/lua.h.

◆ LUA_ERRSYNTAX

#define LUA_ERRSYNTAX   3

Definition at line 52 of file lua-5.4.3/src/lua.h.

◆ LUA_GCCOLLECT

#define LUA_GCCOLLECT   2

Definition at line 321 of file lua-5.4.3/src/lua.h.

◆ LUA_GCCOUNT

#define LUA_GCCOUNT   3

Definition at line 322 of file lua-5.4.3/src/lua.h.

◆ LUA_GCCOUNTB

#define LUA_GCCOUNTB   4

Definition at line 323 of file lua-5.4.3/src/lua.h.

◆ LUA_GCGEN

#define LUA_GCGEN   10

Definition at line 328 of file lua-5.4.3/src/lua.h.

◆ LUA_GCINC

#define LUA_GCINC   11

Definition at line 329 of file lua-5.4.3/src/lua.h.

◆ LUA_GCISRUNNING

#define LUA_GCISRUNNING   9

Definition at line 327 of file lua-5.4.3/src/lua.h.

◆ LUA_GCRESTART

#define LUA_GCRESTART   1

Definition at line 320 of file lua-5.4.3/src/lua.h.

◆ LUA_GCSETPAUSE

#define LUA_GCSETPAUSE   6

Definition at line 325 of file lua-5.4.3/src/lua.h.

◆ LUA_GCSETSTEPMUL

#define LUA_GCSETSTEPMUL   7

Definition at line 326 of file lua-5.4.3/src/lua.h.

◆ LUA_GCSTEP

#define LUA_GCSTEP   5

Definition at line 324 of file lua-5.4.3/src/lua.h.

◆ LUA_GCSTOP

#define LUA_GCSTOP   0

Definition at line 319 of file lua-5.4.3/src/lua.h.

◆ lua_getextraspace

#define lua_getextraspace ( L)    ((void *)((char *)(L) - LUA_EXTRASPACE))

Definition at line 360 of file lua-5.4.3/src/lua.h.

◆ lua_getuservalue

#define lua_getuservalue ( L,
idx )   lua_getiuservalue(L,idx,1)

Definition at line 413 of file lua-5.4.3/src/lua.h.

Referenced by db_getuservalue(), and db_getuservalue().

◆ LUA_HOOKCALL

#define LUA_HOOKCALL   0

Definition at line 430 of file lua-5.4.3/src/lua.h.

◆ LUA_HOOKCOUNT

#define LUA_HOOKCOUNT   3

Definition at line 433 of file lua-5.4.3/src/lua.h.

◆ LUA_HOOKLINE

#define LUA_HOOKLINE   2

Definition at line 432 of file lua-5.4.3/src/lua.h.

◆ LUA_HOOKRET

#define LUA_HOOKRET   1

Definition at line 431 of file lua-5.4.3/src/lua.h.

◆ LUA_HOOKTAILCALL

#define LUA_HOOKTAILCALL   4

Definition at line 434 of file lua-5.4.3/src/lua.h.

◆ lua_insert

#define lua_insert ( L,
idx )   lua_rotate(L, (idx), 1)

Definition at line 390 of file lua-5.4.3/src/lua.h.

◆ lua_isboolean

#define lua_isboolean ( L,
n )   (lua_type(L, (n)) == LUA_TBOOLEAN)

Definition at line 377 of file lua-5.4.3/src/lua.h.

◆ lua_isfunction

#define lua_isfunction ( L,
n )   (lua_type(L, (n)) == LUA_TFUNCTION)

Definition at line 373 of file lua-5.4.3/src/lua.h.

◆ lua_islightuserdata

#define lua_islightuserdata ( L,
n )   (lua_type(L, (n)) == LUA_TLIGHTUSERDATA)

Definition at line 375 of file lua-5.4.3/src/lua.h.

◆ lua_isnil

#define lua_isnil ( L,
n )   (lua_type(L, (n)) == LUA_TNIL)

Definition at line 376 of file lua-5.4.3/src/lua.h.

◆ lua_isnone

#define lua_isnone ( L,
n )   (lua_type(L, (n)) == LUA_TNONE)

Definition at line 379 of file lua-5.4.3/src/lua.h.

◆ lua_isnoneornil

#define lua_isnoneornil ( L,
n )   (lua_type(L, (n)) <= 0)

Definition at line 380 of file lua-5.4.3/src/lua.h.

◆ lua_istable

#define lua_istable ( L,
n )   (lua_type(L, (n)) == LUA_TTABLE)

Definition at line 374 of file lua-5.4.3/src/lua.h.

◆ lua_isthread

#define lua_isthread ( L,
n )   (lua_type(L, (n)) == LUA_TTHREAD)

Definition at line 378 of file lua-5.4.3/src/lua.h.

◆ LUA_MASKCALL

#define LUA_MASKCALL   (1 << LUA_HOOKCALL)

Definition at line 440 of file lua-5.4.3/src/lua.h.

◆ LUA_MASKCOUNT

#define LUA_MASKCOUNT   (1 << LUA_HOOKCOUNT)

Definition at line 443 of file lua-5.4.3/src/lua.h.

◆ LUA_MASKLINE

#define LUA_MASKLINE   (1 << LUA_HOOKLINE)

Definition at line 442 of file lua-5.4.3/src/lua.h.

◆ LUA_MASKRET

#define LUA_MASKRET   (1 << LUA_HOOKRET)

Definition at line 441 of file lua-5.4.3/src/lua.h.

◆ LUA_MINSTACK

#define LUA_MINSTACK   20

Definition at line 80 of file lua-5.4.3/src/lua.h.

◆ LUA_MULTRET

#define LUA_MULTRET   (-1)

Definition at line 36 of file lua-5.4.3/src/lua.h.

◆ lua_newtable

#define lua_newtable ( L)    lua_createtable(L, 0, 0)

Definition at line 367 of file lua-5.4.3/src/lua.h.

◆ lua_newuserdata

◆ LUA_NUMTAGS

#define LUA_NUMTAGS   LUA_NUMTYPES

Definition at line 416 of file lua-5.4.3/src/lua.h.

◆ LUA_NUMTYPES

#define LUA_NUMTYPES   9

Definition at line 75 of file lua-5.4.3/src/lua.h.

Referenced by lua_typename().

◆ LUA_OK

#define LUA_OK   0

Definition at line 49 of file lua-5.4.3/src/lua.h.

◆ LUA_OPADD

#define LUA_OPADD   0 /* ORDER TM, ORDER OP */

Definition at line 205 of file lua-5.4.3/src/lua.h.

◆ LUA_OPBAND

#define LUA_OPBAND   7

Definition at line 212 of file lua-5.4.3/src/lua.h.

◆ LUA_OPBNOT

#define LUA_OPBNOT   13

Definition at line 218 of file lua-5.4.3/src/lua.h.

◆ LUA_OPBOR

#define LUA_OPBOR   8

Definition at line 213 of file lua-5.4.3/src/lua.h.

◆ LUA_OPBXOR

#define LUA_OPBXOR   9

Definition at line 214 of file lua-5.4.3/src/lua.h.

◆ LUA_OPDIV

#define LUA_OPDIV   5

Definition at line 210 of file lua-5.4.3/src/lua.h.

◆ LUA_OPEQ

#define LUA_OPEQ   0

Definition at line 222 of file lua-5.4.3/src/lua.h.

◆ LUA_OPIDIV

#define LUA_OPIDIV   6

Definition at line 211 of file lua-5.4.3/src/lua.h.

◆ LUA_OPLE

#define LUA_OPLE   2

Definition at line 224 of file lua-5.4.3/src/lua.h.

◆ LUA_OPLT

#define LUA_OPLT   1

Definition at line 223 of file lua-5.4.3/src/lua.h.

◆ LUA_OPMOD

#define LUA_OPMOD   3

Definition at line 208 of file lua-5.4.3/src/lua.h.

◆ LUA_OPMUL

#define LUA_OPMUL   2

Definition at line 207 of file lua-5.4.3/src/lua.h.

◆ LUA_OPPOW

#define LUA_OPPOW   4

Definition at line 209 of file lua-5.4.3/src/lua.h.

◆ LUA_OPSHL

#define LUA_OPSHL   10

Definition at line 215 of file lua-5.4.3/src/lua.h.

◆ LUA_OPSHR

#define LUA_OPSHR   11

Definition at line 216 of file lua-5.4.3/src/lua.h.

◆ LUA_OPSUB

#define LUA_OPSUB   1

Definition at line 206 of file lua-5.4.3/src/lua.h.

◆ LUA_OPUNM

#define LUA_OPUNM   12

Definition at line 217 of file lua-5.4.3/src/lua.h.

◆ lua_pcall

#define lua_pcall ( L,
n,
r,
f )   lua_pcallk(L, (n), (r), (f), 0, NULL)

Definition at line 287 of file lua-5.4.3/src/lua.h.

◆ lua_pop

#define lua_pop ( L,
n )   lua_settop(L, -(n)-1)

Definition at line 365 of file lua-5.4.3/src/lua.h.

◆ lua_pushcfunction

#define lua_pushcfunction ( L,
f )   lua_pushcclosure(L, (f), 0)

Definition at line 371 of file lua-5.4.3/src/lua.h.

◆ lua_pushglobaltable

#define lua_pushglobaltable ( L)     ((void)lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS))

Definition at line 384 of file lua-5.4.3/src/lua.h.

384#define lua_pushglobaltable(L) \
385 ((void)lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS))

◆ lua_pushliteral

#define lua_pushliteral ( L,
s )   lua_pushstring(L, "" s)

Definition at line 382 of file lua-5.4.3/src/lua.h.

◆ lua_register

#define lua_register ( L,
n,
f )   (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))

Definition at line 369 of file lua-5.4.3/src/lua.h.

◆ LUA_REGISTRYINDEX

#define LUA_REGISTRYINDEX   (-LUAI_MAXSTACK - 1000)

Definition at line 44 of file lua-5.4.3/src/lua.h.

◆ LUA_RELEASE

#define LUA_RELEASE   LUA_VERSION "." LUA_VERSION_RELEASE

Definition at line 27 of file lua-5.4.3/src/lua.h.

◆ lua_remove

#define lua_remove ( L,
idx )   (lua_rotate(L, (idx), -1), lua_pop(L, 1))

Definition at line 392 of file lua-5.4.3/src/lua.h.

◆ lua_replace

#define lua_replace ( L,
idx )   (lua_copy(L, -1, (idx)), lua_pop(L, 1))

Definition at line 394 of file lua-5.4.3/src/lua.h.

◆ LUA_RIDX_GLOBALS

#define LUA_RIDX_GLOBALS   2

Definition at line 85 of file lua-5.4.3/src/lua.h.

◆ LUA_RIDX_LAST

#define LUA_RIDX_LAST   LUA_RIDX_GLOBALS

Definition at line 86 of file lua-5.4.3/src/lua.h.

◆ LUA_RIDX_MAINTHREAD

#define LUA_RIDX_MAINTHREAD   1

Definition at line 84 of file lua-5.4.3/src/lua.h.

◆ lua_setuservalue

#define lua_setuservalue ( L,
idx )   lua_setiuservalue(L,idx,1)

Definition at line 414 of file lua-5.4.3/src/lua.h.

Referenced by db_setuservalue(), and db_setuservalue().

◆ LUA_SIGNATURE

#define LUA_SIGNATURE   "\x1bLua"

Definition at line 33 of file lua-5.4.3/src/lua.h.

◆ LUA_TBOOLEAN

#define LUA_TBOOLEAN   1

Definition at line 66 of file lua-5.4.3/src/lua.h.

◆ LUA_TFUNCTION

#define LUA_TFUNCTION   6

Definition at line 71 of file lua-5.4.3/src/lua.h.

◆ LUA_TLIGHTUSERDATA

#define LUA_TLIGHTUSERDATA   2

Definition at line 67 of file lua-5.4.3/src/lua.h.

◆ LUA_TNIL

#define LUA_TNIL   0

Definition at line 65 of file lua-5.4.3/src/lua.h.

◆ LUA_TNONE

#define LUA_TNONE   (-1)

Definition at line 63 of file lua-5.4.3/src/lua.h.

◆ LUA_TNUMBER

#define LUA_TNUMBER   3

Definition at line 68 of file lua-5.4.3/src/lua.h.

◆ lua_tointeger

#define lua_tointeger ( L,
i )   lua_tointegerx(L,(i),NULL)

Definition at line 363 of file lua-5.4.3/src/lua.h.

◆ lua_tonumber

#define lua_tonumber ( L,
i )   lua_tonumberx(L,(i),NULL)

Definition at line 362 of file lua-5.4.3/src/lua.h.

◆ lua_tostring

#define lua_tostring ( L,
i )   lua_tolstring(L, (i), NULL)

Definition at line 387 of file lua-5.4.3/src/lua.h.

◆ LUA_TSTRING

#define LUA_TSTRING   4

Definition at line 69 of file lua-5.4.3/src/lua.h.

◆ LUA_TTABLE

#define LUA_TTABLE   5

Definition at line 70 of file lua-5.4.3/src/lua.h.

◆ LUA_TTHREAD

#define LUA_TTHREAD   8

Definition at line 73 of file lua-5.4.3/src/lua.h.

◆ LUA_TUSERDATA

#define LUA_TUSERDATA   7

Definition at line 72 of file lua-5.4.3/src/lua.h.

◆ lua_upvalueindex

#define lua_upvalueindex ( i)    (LUA_REGISTRYINDEX - (i))

Definition at line 45 of file lua-5.4.3/src/lua.h.

◆ LUA_VERSION

#define LUA_VERSION   "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR

Definition at line 26 of file lua-5.4.3/src/lua.h.

◆ LUA_VERSION_MAJOR

#define LUA_VERSION_MAJOR   "5"

Definition at line 19 of file lua-5.4.3/src/lua.h.

◆ LUA_VERSION_MINOR

#define LUA_VERSION_MINOR   "4"

Definition at line 20 of file lua-5.4.3/src/lua.h.

◆ LUA_VERSION_NUM

#define LUA_VERSION_NUM   504

Definition at line 23 of file lua-5.4.3/src/lua.h.

◆ LUA_VERSION_RELEASE

#define LUA_VERSION_RELEASE   "3"

Definition at line 21 of file lua-5.4.3/src/lua.h.

◆ LUA_VERSION_RELEASE_NUM

#define LUA_VERSION_RELEASE_NUM   (LUA_VERSION_NUM * 100 + 0)

Definition at line 24 of file lua-5.4.3/src/lua.h.

◆ LUA_YIELD

#define LUA_YIELD   1

Definition at line 50 of file lua-5.4.3/src/lua.h.

◆ lua_yield

#define lua_yield ( L,
n )   lua_yieldk(L, (n), 0, NULL)

Definition at line 305 of file lua-5.4.3/src/lua.h.

Typedef Documentation

◆ lua_Alloc

typedef void *(* lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize)

Definition at line 125 of file lua-5.4.3/src/lua.h.

◆ lua_CFunction

typedef int(* lua_CFunction) (lua_State *L)

Definition at line 106 of file lua-5.4.3/src/lua.h.

◆ lua_Debug

typedef struct lua_Debug lua_Debug

Definition at line 445 of file lua-5.4.3/src/lua.h.

◆ lua_Hook

typedef void(* lua_Hook) (lua_State *L, lua_Debug *ar)

Definition at line 449 of file lua-5.4.3/src/lua.h.

◆ lua_Integer

Definition at line 94 of file lua-5.4.3/src/lua.h.

◆ lua_KContext

Definition at line 100 of file lua-5.4.3/src/lua.h.

◆ lua_KFunction

typedef int(* lua_KFunction) (lua_State *L, int status, lua_KContext ctx)

Definition at line 111 of file lua-5.4.3/src/lua.h.

◆ lua_Number

Definition at line 90 of file lua-5.4.3/src/lua.h.

◆ lua_Reader

typedef const char *(* lua_Reader) (lua_State *L, void *ud, size_t *sz)

Definition at line 117 of file lua-5.4.3/src/lua.h.

◆ lua_State

typedef struct lua_State lua_State

Definition at line 57 of file lua-5.4.3/src/lua.h.

◆ lua_Unsigned

Definition at line 97 of file lua-5.4.3/src/lua.h.

◆ lua_WarnFunction

typedef void(* lua_WarnFunction) (void *ud, const char *msg, int tocont)

Definition at line 131 of file lua-5.4.3/src/lua.h.

◆ lua_Writer

typedef int(* lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud)

Definition at line 119 of file lua-5.4.3/src/lua.h.

Function Documentation

◆ lua_absindex()

LUA_API int lua_absindex ( lua_State * L,
int idx )

Definition at line 153 of file lua-5.2.4/src/lapi.c.

153 {
154 return (idx > 0 || ispseudo(idx))
155 ? idx
156 : cast_int(L->top - L->ci->func + idx);
157}
#define cast_int(i)
#define ispseudo(i)

References cast_int, lua_State::ci, CallInfo::func, ispseudo, and lua_State::top.

Referenced by luaL_callmeta(), luaL_getsubtable(), luaL_ref(), and luaL_unref().

◆ lua_arith()

LUA_API void lua_arith ( lua_State * L,
int op )

Definition at line 293 of file lua-5.2.4/src/lapi.c.

293 {
294 StkId o1; /* 1st operand */
295 StkId o2; /* 2nd operand */
296 lua_lock(L);
297 if (op != LUA_OPUNM) /* all other operations expect two operands */
298 api_checknelems(L, 2);
299 else { /* for unary minus, add fake 2nd operand */
300 api_checknelems(L, 1);
301 setobjs2s(L, L->top, L->top - 1);
302 L->top++;
303 }
304 o1 = L->top - 2;
305 o2 = L->top - 1;
306 if (ttisnumber(o1) && ttisnumber(o2)) {
307 setnvalue(o1, luaO_arith(op, nvalue(o1), nvalue(o2)));
308 }
309 else
310 luaV_arith(L, o1, o1, o2, cast(TMS, op - LUA_OPADD + TM_ADD));
311 L->top--;
312 lua_unlock(L);
313}
#define api_checknelems(L, n)
#define lua_unlock(L)
#define lua_lock(L)
#define cast(t, exp)
#define nvalue(o)
#define setobjs2s
#define setnvalue(obj, x)
#define ttisnumber(o)
@ TM_ADD
lua_Number luaO_arith(int op, lua_Number v1, lua_Number v2)
#define LUA_OPADD
#define LUA_OPUNM
void luaV_arith(lua_State *L, StkId ra, const TValue *rb, const TValue *rc, TMS op)

References api_checknelems, api_incr_top, cast, lua_lock, LUA_OPADD, LUA_OPBNOT, LUA_OPUNM, lua_unlock, luaO_arith(), luaV_arith(), nvalue, s2v, setnvalue, setobjs2s, TM_ADD, lua_State::top, and ttisnumber.

Referenced by arith().

◆ lua_atpanic()

LUA_API lua_CFunction lua_atpanic ( lua_State * L,
lua_CFunction panicf )

Definition at line 130 of file lua-5.1.5/src/lapi.c.

130 {
131 lua_CFunction old;
132 lua_lock(L);
133 old = G(L)->panic;
134 G(L)->panic = panicf;
135 lua_unlock(L);
136 return old;
137}
#define G(L)
int(* lua_CFunction)(lua_State *L)

References G, lua_lock, and lua_unlock.

Referenced by luaL_newstate().

◆ lua_callk()

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

Definition at line 909 of file lua-5.3.6/src/lapi.c.

910 {
911 StkId func;
912 lua_lock(L);
913 api_check(L, k == NULL || !isLua(L->ci),
914 "cannot use continuations inside hooks");
915 api_checknelems(L, nargs+1);
916 api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread");
917 checkresults(L, nargs, nresults);
918 func = L->top - (nargs+1);
919 if (k != NULL && L->nny == 0) { /* need to prepare continuation? */
920 L->ci->u.c.k = k; /* save continuation */
921 L->ci->u.c.ctx = ctx; /* save context */
922 luaD_call(L, func, nresults); /* do the call */
923 }
924 else /* no continuation or no yieldable */
925 luaD_callnoyield(L, func, nresults); /* just do the call */
926 adjustresults(L, nresults);
927 lua_unlock(L);
928}
#define NULL
Definition gmacros.h:924
#define adjustresults(L, nres)
void luaD_call(lua_State *L, StkId func, int nResults)
#define api_check
#define isLua(ci)
#define LUA_OK
#define checkresults(L, na, nr)
void luaD_callnoyield(lua_State *L, StkId func, int nResults)
lua_CFunction k
union CallInfo::@64 u
struct CallInfo::@64::@66 c
unsigned short nny

References adjustresults, api_check, api_checknelems, CallInfo::c, checkresults, lua_State::ci, CallInfo::ctx, isLua, CallInfo::k, lua_lock, LUA_OK, lua_unlock, luaD_call(), luaD_callnoyield(), lua_State::nny, NULL, lua_State::status, lua_State::top, CallInfo::u, and yieldable.

◆ lua_checkstack()

◆ lua_close()

LUA_API void lua_close ( lua_State * L)

Definition at line 199 of file lua-5.1.5/src/lstate.c.

199 {
200 L = G(L)->mainthread; /* only the main thread can be closed */
201 lua_lock(L);
202 luaF_close(L, L->stack); /* close all upvalues for this thread */
203 luaC_separateudata(L, 1); /* separate udata that have GC metamethods */
204 L->errfunc = 0; /* no error function during GC metamethods */
205 do { /* repeat until no more errors */
206 L->ci = L->base_ci;
207 L->base = L->top = L->ci->base;
208 L->nCcalls = L->baseCcalls = 0;
209 } while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0);
210 lua_assert(G(L)->tmudata == NULL);
212 close_state(L);
213}
int luaD_rawrunprotected(lua_State *L, Pfunc f, void *ud)
void luaF_close(lua_State *L, StkId level)
size_t luaC_separateudata(lua_State *L, int all)
#define lua_assert(c)
static void close_state(lua_State *L)
static void callallgcTM(lua_State *L, void *ud)
#define luai_userstateclose(L)
unsigned short nCcalls
unsigned short baseCcalls

References CallInfo::base, lua_State::base, lua_State::base_ci, lua_State::baseCcalls, callallgcTM(), lua_State::ci, close_state(), close_state(), close_state(), close_state(), lua_State::errfunc, G, lua_assert, lua_lock, luaC_separateudata(), luaD_rawrunprotected(), luaF_close(), luai_userstateclose, lua_State::nCcalls, NULL, lua_State::stack, and lua_State::top.

Referenced by main(), main(), main(), master_thread_run(), os_exit(), os_exit(), and os_exit().

◆ lua_closeslot()

LUA_API void lua_closeslot ( lua_State * L,
int idx )

Definition at line 202 of file lua-5.4.3/src/lapi.c.

202 {
203 StkId level;
204 lua_lock(L);
205 level = index2stack(L, idx);
206 api_check(L, hastocloseCfunc(L->ci->nresults) && L->tbclist == level,
207 "no variable to close at given level");
208 luaF_close(L, level, CLOSEKTOP, 0);
209 level = index2stack(L, idx); /* stack may be moved */
210 setnilvalue(s2v(level));
211 lua_unlock(L);
212}
#define setnilvalue(obj)
static StkId index2stack(lua_State *L, int idx)
#define hastocloseCfunc(n)
#define CLOSEKTOP
#define s2v(o)

References api_check, lua_State::ci, CLOSEKTOP, hastocloseCfunc, index2stack(), lua_lock, lua_unlock, luaF_close(), CallInfo::nresults, s2v, setnilvalue, and lua_State::tbclist.

Referenced by luaL_pushresult().

◆ lua_compare()

LUA_API int lua_compare ( lua_State * L,
int idx1,
int idx2,
int op )

Definition at line 316 of file lua-5.2.4/src/lapi.c.

316 {
317 StkId o1, o2;
318 int i = 0;
319 lua_lock(L); /* may call tag method */
320 o1 = index2addr(L, index1);
321 o2 = index2addr(L, index2);
322 if (isvalid(o1) && isvalid(o2)) {
323 switch (op) {
324 case LUA_OPEQ: i = equalobj(L, o1, o2); break;
325 case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break;
326 case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break;
327 default: api_check(L, 0, "invalid option");
328 }
329 }
330 lua_unlock(L);
331 return i;
332}
int luaV_lessthan(lua_State *L, const TValue *l, const TValue *r)
#define equalobj(L, o1, o2)
#define isvalid(o)
static TValue * index2addr(lua_State *L, int idx)
#define LUA_OPLT
#define LUA_OPLE
#define LUA_OPEQ
int luaV_lessequal(lua_State *L, const TValue *l, const TValue *r)

References api_check, equalobj, index2addr(), index2addr(), index2value(), isvalid, lua_lock, LUA_OPEQ, LUA_OPLE, LUA_OPLT, lua_unlock, luaV_equalobj(), luaV_lessequal(), and luaV_lessthan().

Referenced by math_max(), math_max(), math_min(), math_min(), sort_comp(), sort_comp(), sort_comp(), tmove(), and tmove().

◆ lua_concat()

LUA_API void lua_concat ( lua_State * L,
int n )

Definition at line 990 of file lua-5.1.5/src/lapi.c.

990 {
991 lua_lock(L);
992 api_checknelems(L, n);
993 if (n >= 2) {
994 luaC_checkGC(L);
995 luaV_concat(L, n, cast_int(L->top - L->base) - 1);
996 L->top -= (n-1);
997 }
998 else if (n == 0) { /* push empty string */
999 setsvalue2s(L, L->top, luaS_newlstr(L, "", 0));
1000 api_incr_top(L);
1001 }
1002 /* else n == 1; nothing to do */
1003 lua_unlock(L);
1004}
#define api_incr_top(L)
#define luaC_checkGC(L)
#define setsvalue2s
TString * luaS_newlstr(lua_State *L, const char *str, size_t l)
void luaV_concat(lua_State *L, int total, int last)

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.

Referenced by adjuststack(), db_errorfb(), findfield(), findfield(), findfield(), findfile(), ll_require(), loadline(), loadline(), luaB_auxwrap(), luaB_auxwrap(), luaB_auxwrap(), luaB_auxwrap(), luaB_error(), luaB_error(), luaB_error(), luaB_error(), luaL_error(), luaL_pushresult(), luaL_traceback(), multiline(), multiline(), and Xml_str().

◆ lua_copy()

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

Definition at line 226 of file lua-5.2.4/src/lapi.c.

226 {
227 TValue *fr;
228 lua_lock(L);
229 fr = index2addr(L, fromidx);
230 moveto(L, fr, toidx);
231 lua_unlock(L);
232}
static void moveto(lua_State *L, TValue *fr, int idx)

References api_check, api_checkvalidindex, lua_State::ci, clCvalue, CallInfo::func, index2addr(), index2addr(), index2value(), isupvalue, isvalid, lua_lock, lua_unlock, luaC_barrier, moveto(), s2v, and setobj.

Referenced by ll_require(), luaB_xpcall(), pushglobalfuncname(), pushglobalfuncname(), and pushglobalfuncname().

◆ lua_createtable()

◆ lua_dump()

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

Definition at line 1016 of file lua-5.3.6/src/lapi.c.

1016 {
1017 int status;
1018 TValue *o;
1019 lua_lock(L);
1020 api_checknelems(L, 1);
1021 o = L->top - 1;
1022 if (isLfunction(o))
1023 status = luaU_dump(L, getproto(o), writer, data, strip);
1024 else
1025 status = 1;
1026 lua_unlock(L);
1027 return status;
1028}
int luaU_dump(lua_State *L, const Proto *f, lua_Writer w, void *data, int strip)
#define isLfunction(o)
static int writer(lua_State *L, const void *b, size_t size, void *B)
#define getproto(o)

References api_checknelems, getproto, isLfunction, lua_lock, lua_unlock, luaU_dump(), s2v, lua_State::top, and writer().

◆ lua_error()

◆ lua_gc()

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

Definition at line 1126 of file lua-5.4.3/src/lapi.c.

1126 {
1127 va_list argp;
1128 int res = 0;
1129 global_State *g;
1130 lua_lock(L);
1131 g = G(L);
1132 va_start(argp, what);
1133 switch (what) {
1134 case LUA_GCSTOP: {
1135 g->gcrunning = 0;
1136 break;
1137 }
1138 case LUA_GCRESTART: {
1139 luaE_setdebt(g, 0);
1140 g->gcrunning = 1;
1141 break;
1142 }
1143 case LUA_GCCOLLECT: {
1144 luaC_fullgc(L, 0);
1145 break;
1146 }
1147 case LUA_GCCOUNT: {
1148 /* GC values are expressed in Kbytes: #bytes/2^10 */
1149 res = cast_int(gettotalbytes(g) >> 10);
1150 break;
1151 }
1152 case LUA_GCCOUNTB: {
1153 res = cast_int(gettotalbytes(g) & 0x3ff);
1154 break;
1155 }
1156 case LUA_GCSTEP: {
1157 int data = va_arg(argp, int);
1158 l_mem debt = 1; /* =1 to signal that it did an actual step */
1159 lu_byte oldrunning = g->gcrunning;
1160 g->gcrunning = 1; /* allow GC to run */
1161 if (data == 0) {
1162 luaE_setdebt(g, 0); /* do a basic step */
1163 luaC_step(L);
1164 }
1165 else { /* add 'data' to total debt */
1166 debt = cast(l_mem, data) * 1024 + g->GCdebt;
1167 luaE_setdebt(g, debt);
1168 luaC_checkGC(L);
1169 }
1170 g->gcrunning = oldrunning; /* restore previous state */
1171 if (debt > 0 && g->gcstate == GCSpause) /* end of cycle? */
1172 res = 1; /* signal it */
1173 break;
1174 }
1175 case LUA_GCSETPAUSE: {
1176 int data = va_arg(argp, int);
1177 res = getgcparam(g->gcpause);
1178 setgcparam(g->gcpause, data);
1179 break;
1180 }
1181 case LUA_GCSETSTEPMUL: {
1182 int data = va_arg(argp, int);
1183 res = getgcparam(g->gcstepmul);
1184 setgcparam(g->gcstepmul, data);
1185 break;
1186 }
1187 case LUA_GCISRUNNING: {
1188 res = g->gcrunning;
1189 break;
1190 }
1191 case LUA_GCGEN: {
1192 int minormul = va_arg(argp, int);
1193 int majormul = va_arg(argp, int);
1194 res = isdecGCmodegen(g) ? LUA_GCGEN : LUA_GCINC;
1195 if (minormul != 0)
1196 g->genminormul = minormul;
1197 if (majormul != 0)
1198 setgcparam(g->genmajormul, majormul);
1200 break;
1201 }
1202 case LUA_GCINC: {
1203 int pause = va_arg(argp, int);
1204 int stepmul = va_arg(argp, int);
1205 int stepsize = va_arg(argp, int);
1206 res = isdecGCmodegen(g) ? LUA_GCGEN : LUA_GCINC;
1207 if (pause != 0)
1208 setgcparam(g->gcpause, pause);
1209 if (stepmul != 0)
1210 setgcparam(g->gcstepmul, stepmul);
1211 if (stepsize != 0)
1212 g->gcstepsize = stepsize;
1214 break;
1215 }
1216 default: res = -1; /* invalid option */
1217 }
1218 va_end(argp);
1219 lua_unlock(L);
1220 return res;
1221}
void luaC_fullgc(lua_State *L)
void luaC_step(lua_State *L)
#define GCSpause
LUAI_MEM l_mem
unsigned char lu_byte
#define LUA_GCSETPAUSE
#define LUA_GCCOUNT
#define LUA_GCCOLLECT
#define LUA_GCSTOP
#define LUA_GCRESTART
#define LUA_GCCOUNTB
#define LUA_GCSTEP
#define LUA_GCSETSTEPMUL
void luaC_changemode(lua_State *L, int mode)
void luaE_setdebt(global_State *g, l_mem debt)
#define gettotalbytes(g)
#define KGC_GEN
#define LUA_GCGEN
#define LUA_GCINC
#define LUA_GCISRUNNING
#define getgcparam(p)
#define isdecGCmodegen(g)
#define setgcparam(p, v)
#define KGC_INC

References cast, cast_int, G, global_State::GCdebt, global_State::gcpause, global_State::gcrunning, GCSpause, global_State::gcstate, global_State::gcstepmul, global_State::gcstepsize, global_State::genmajormul, global_State::genminormul, getgcparam, gettotalbytes, isdecGCmodegen, KGC_GEN, KGC_INC, LUA_GCCOLLECT, LUA_GCCOUNT, LUA_GCCOUNTB, LUA_GCGEN, LUA_GCINC, LUA_GCISRUNNING, LUA_GCRESTART, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL, LUA_GCSTEP, LUA_GCSTOP, lua_lock, lua_unlock, luaC_changemode(), luaC_checkGC, luaC_fullgc(), luaC_step(), luaE_setdebt(), and setgcparam.

◆ lua_getallocf()

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

Definition at line 1007 of file lua-5.1.5/src/lapi.c.

1007 {
1008 lua_Alloc f;
1009 lua_lock(L);
1010 if (ud) *ud = G(L)->ud;
1011 f = G(L)->frealloc;
1012 lua_unlock(L);
1013 return f;
1014}
void *(* lua_Alloc)(void *ud, void *ptr, size_t osize, size_t nsize)

References G, lua_lock, lua_unlock, and CCallS::ud.

Referenced by resizebox(), and resizebox().

◆ lua_getfield()

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

Definition at line 544 of file lua-5.1.5/src/lapi.c.

544 {
545 StkId t;
546 TValue key;
547 lua_lock(L);
548 t = index2adr(L, idx);
550 setsvalue(L, &key, luaS_new(L, k));
551 luaV_gettable(L, t, &key, L->top);
552 api_incr_top(L);
553 lua_unlock(L);
554}
#define api_checkvalidindex(L, i)
static TValue * index2adr(lua_State *L, int idx)
#define setsvalue(L, obj, x)
#define luaS_new(L, s)
#define luaV_gettable(L, t, k, v)

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

Referenced by addtoclib(), aux_close(), checkclib(), checkclib(), db_gethook(), findfile(), findfile(), findfile(), findfile(), findloader(), findloader(), findloader(), g_iofile(), g_iofile(), g_iofile(), get_prompt(), getboolfield(), getboolfield(), getboolfield(), getboolfield(), getfield(), getfield(), getfield(), getfield(), getiofile(), getiofile(), getiofile(), hookf(), io_close(), io_close(), io_close(), io_lines(), io_lines(), io_lines(), io_type(), ll_addtoclib(), ll_checkclib(), ll_module(), ll_require(), ll_require(), ll_require(), ll_require(), loader_preload(), luaI_openlib(), luaL_checkudata(), luaL_getsubtable(), luaL_newmetatable(), luaL_requiref(), luaopen_io(), luaopen_math(), luaopen_package(), luaopen_string(), luaopen_table(), noenv(), noenv(), noenv(), pushglobalfuncname(), pushglobalfuncname(), searcher_preload(), searcher_preload(), searcher_preload(), and traceback().

◆ lua_getglobal()

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

Definition at line 608 of file lua-5.2.4/src/lapi.c.

608 {
609 Table *reg = hvalue(&G(L)->l_registry);
610 const TValue *gt; /* global table */
611 lua_lock(L);
613 setsvalue2s(L, L->top++, luaS_new(L, var));
614 luaV_gettable(L, gt, L->top - 1, L->top - 1);
615 lua_unlock(L);
616}
#define hvalue(o)
#define gt(L)
const TValue * luaH_getint(Table *t, int key)
#define LUA_RIDX_GLOBALS

References auxgetstr(), auxgetstr(), G, getGtable, gt, hvalue, lua_lock, LUA_RIDX_GLOBALS, lua_unlock, luaH_getint(), luaS_new, luaV_gettable, name, setsvalue2s, and lua_State::top.

◆ lua_gethook()

LUA_API lua_Hook lua_gethook ( lua_State * L)

Definition at line 69 of file lua-5.1.5/src/ldebug.c.

69 {
70 return L->hook;
71}

References lua_State::hook.

Referenced by db_gethook(), db_gethook(), db_gethook(), and db_gethook().

◆ lua_gethookcount()

LUA_API int lua_gethookcount ( lua_State * L)

Definition at line 79 of file lua-5.1.5/src/ldebug.c.

79 {
80 return L->basehookcount;
81}

References lua_State::basehookcount.

Referenced by db_gethook(), db_gethook(), db_gethook(), and db_gethook().

◆ lua_gethookmask()

LUA_API int lua_gethookmask ( lua_State * L)

Definition at line 74 of file lua-5.1.5/src/ldebug.c.

74 {
75 return L->hookmask;
76}

References lua_State::hookmask.

Referenced by db_gethook(), db_gethook(), db_gethook(), and db_gethook().

◆ lua_geti()

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

Definition at line 628 of file lua-5.3.6/src/lapi.c.

628 {
629 StkId t;
630 const TValue *slot;
631 lua_lock(L);
632 t = index2addr(L, idx);
633 if (luaV_fastget(L, t, n, slot, luaH_getint)) {
634 setobj2s(L, L->top, slot);
635 api_incr_top(L);
636 }
637 else {
638 setivalue(L->top, n);
639 api_incr_top(L);
640 luaV_finishget(L, t, L->top - 1, L->top - 1, slot);
641 }
642 lua_unlock(L);
643 return ttnov(L->top - 1);
644}
#define setobj2s
static TValue * index2addr(lua_State *L, int idx)
#define ttnov(o)
#define setivalue(obj, x)
void luaV_finishget(lua_State *L, const TValue *t, TValue *key, StkId val, const TValue *slot)
#define luaV_fastget(L, t, k, slot, f)

References api_incr_top, index2addr(), index2value(), lua_lock, lua_unlock, luaH_getint(), luaV_fastget, luaV_fastgeti, luaV_finishget(), s2v, setivalue, setobj2s, lua_State::top, ttnov, and ttype.

Referenced by addfield(), addfield(), auxsort(), auxsort(), ipairsaux(), ipairsaux(), partition(), partition(), tinsert(), tinsert(), tmove(), tmove(), tremove(), tremove(), tunpack(), and unpack().

◆ lua_getinfo()

LUA_API int lua_getinfo ( lua_State * L,
const char * what,
lua_Debug * ar )

Definition at line 232 of file lua-5.1.5/src/ldebug.c.

232 {
233 int status;
234 Closure *f = NULL;
235 CallInfo *ci = NULL;
236 lua_lock(L);
237 if (*what == '>') {
238 StkId func = L->top - 1;
239 luai_apicheck(L, ttisfunction(func));
240 what++; /* skip the '>' */
241 f = clvalue(func);
242 L->top--; /* pop function */
243 }
244 else if (ar->i_ci != 0) { /* no tail call? */
245 ci = L->base_ci + ar->i_ci;
247 f = clvalue(ci->func);
248 }
249 status = auxgetinfo(L, what, ar, f, ci);
250 if (strchr(what, 'f')) {
251 if (f == NULL) setnilvalue(L->top);
252 else setclvalue(L, L->top, f);
253 incr_top(L);
254 }
255 if (strchr(what, 'L'))
256 collectvalidlines(L, f);
257 lua_unlock(L);
258 return status;
259}
static void collectvalidlines(lua_State *L, Closure *f)
static int auxgetinfo(lua_State *L, const char *what, lua_Debug *ar, Closure *f, CallInfo *ci)
#define incr_top(L)
#define ttisfunction(o)
#define clvalue(o)
#define setclvalue(L, obj, x)
#define luai_apicheck(L, o)

References api_check, api_incr_top, auxgetinfo(), auxgetinfo(), auxgetinfo(), auxgetinfo(), lua_State::base_ci, clvalue, collectvalidlines(), collectvalidlines(), collectvalidlines(), collectvalidlines(), CallInfo::func, lua_Debug::i_ci, incr_top, lua_assert, lua_lock, lua_unlock, luai_apicheck, NULL, s2v, setclvalue, setnilvalue, setobj2s, setobjs2s, swapextra(), swapextra(), lua_State::top, ttisclosure, and ttisfunction.

Referenced by checkupval(), db_errorfb(), db_getinfo(), db_getinfo(), db_getinfo(), db_getinfo(), getfunc(), hookf(), hookf(), hookf(), hookf(), luaL_argerror(), luaL_argerror(), luaL_traceback(), luaL_where(), pushglobalfuncname(), pushglobalfuncname(), pushglobalfuncname(), and setfenv().

◆ lua_getiuservalue()

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

Definition at line 796 of file lua-5.4.3/src/lapi.c.

796 {
797 TValue *o;
798 int t;
799 lua_lock(L);
800 o = index2value(L, idx);
801 api_check(L, ttisfulluserdata(o), "full userdata expected");
802 if (n <= 0 || n > uvalue(o)->nuvalue) {
803 setnilvalue(s2v(L->top));
804 t = LUA_TNONE;
805 }
806 else {
807 setobj2s(L, L->top, &uvalue(o)->uv[n - 1].uv);
808 t = ttype(s2v(L->top));
809 }
810 api_incr_top(L);
811 lua_unlock(L);
812 return t;
813}
#define uvalue(o)
#define ttype(o)
#define LUA_TNONE
#define ttisfulluserdata(o)
static TValue * index2value(lua_State *L, int idx)

References api_check, api_incr_top, index2value(), lua_lock, LUA_TNONE, lua_unlock, s2v, setnilvalue, setobj2s, lua_State::top, ttisfulluserdata, ttype, and uvalue.

Referenced by db_getuservalue().

◆ lua_getlocal()

LUA_API const char * lua_getlocal ( lua_State * L,
const lua_Debug * ar,
int n )

Definition at line 127 of file lua-5.1.5/src/ldebug.c.

127 {
128 CallInfo *ci = L->base_ci + ar->i_ci;
129 const char *name = findlocal(L, ci, n);
130 lua_lock(L);
131 if (name)
132 luaA_pushobject(L, ci->base + (n - 1));
133 lua_unlock(L);
134 return name;
135}
const char * name
Definition lsqlite3.c:2154
void luaA_pushobject(lua_State *L, const TValue *o)
static const char * findlocal(lua_State *L, CallInfo *ci, int n)

References api_incr_top, CallInfo::base, lua_State::base_ci, clLvalue, findlocal(), findlocal(), findlocal(), lua_Debug::i_ci, isLfunction, lua_lock, lua_unlock, luaA_pushobject(), luaF_getlocalname(), luaG_findlocal(), name, NULL, s2v, setobj2s, setobjs2s, swapextra(), swapextra(), and lua_State::top.

Referenced by db_getlocal(), db_getlocal(), db_getlocal(), and db_getlocal().

◆ lua_getmetatable()

LUA_API int lua_getmetatable ( lua_State * L,
int objindex )

Definition at line 587 of file lua-5.1.5/src/lapi.c.

587 {
588 const TValue *obj;
589 Table *mt = NULL;
590 int res;
591 lua_lock(L);
592 obj = index2adr(L, objindex);
593 switch (ttype(obj)) {
594 case LUA_TTABLE:
595 mt = hvalue(obj)->metatable;
596 break;
597 case LUA_TUSERDATA:
598 mt = uvalue(obj)->metatable;
599 break;
600 default:
601 mt = G(L)->mt[ttype(obj)];
602 break;
603 }
604 if (mt == NULL)
605 res = 0;
606 else {
607 sethvalue(L, L->top, mt);
608 api_incr_top(L);
609 res = 1;
610 }
611 lua_unlock(L);
612 return res;
613}
#define LUA_TTABLE
#define LUA_TUSERDATA
struct Table * metatable

References api_incr_top, G, hvalue, index2addr(), index2addr(), index2adr(), index2value(), lua_lock, LUA_TTABLE, LUA_TUSERDATA, lua_unlock, Table::metatable, NULL, sethvalue, sethvalue2s, lua_State::top, ttnov, ttype, ttypenv, and uvalue.

Referenced by checktab(), checktab(), db_getmetatable(), db_getmetatable(), db_getmetatable(), db_getmetatable(), io_type(), ll_seeall(), luaB_getmetatable(), luaB_getmetatable(), luaB_getmetatable(), luaB_getmetatable(), luaB_newproxy(), luaL_checkudata(), luaL_getmetafield(), and luaL_testudata().

◆ lua_getstack()

LUA_API int lua_getstack ( lua_State * L,
int level,
lua_Debug * ar )

Definition at line 84 of file lua-5.1.5/src/ldebug.c.

84 {
85 int status;
86 CallInfo *ci;
87 lua_lock(L);
88 for (ci = L->ci; level > 0 && ci > L->base_ci; ci--) {
89 level--;
90 if (f_isLua(ci)) /* Lua function? */
91 level -= ci->tailcalls; /* skip lost tail calls */
92 }
93 if (level == 0 && ci > L->base_ci) { /* level found? */
94 status = 1;
95 ar->i_ci = cast_int(ci - L->base_ci);
96 }
97 else if (level < 0) { /* level is of a lost tail call? */
98 status = 1;
99 ar->i_ci = 0;
100 }
101 else status = 0; /* no such level */
102 lua_unlock(L);
103 return status;
104}
#define f_isLua(ci)

References lua_State::base_ci, cast_int, lua_State::ci, f_isLua, lua_Debug::i_ci, lua_lock, lua_unlock, CallInfo::previous, and CallInfo::tailcalls.

Referenced by auxstatus(), costatus(), countlevels(), db_errorfb(), db_getinfo(), db_getinfo(), db_getinfo(), db_getinfo(), db_getlocal(), db_getlocal(), db_getlocal(), db_getlocal(), db_setlocal(), db_setlocal(), db_setlocal(), db_setlocal(), getfunc(), lastlevel(), lastlevel(), luaB_costatus(), luaB_costatus(), luaL_argerror(), luaL_argerror(), luaL_traceback(), luaL_where(), and setfenv().

◆ lua_gettable()

◆ lua_gettop()

LUA_API int lua_gettop ( lua_State * L)

Definition at line 159 of file lua-5.1.5/src/lapi.c.

159 {
160 return cast_int(L->top - L->base);
161}

References lua_State::base, cast_int, lua_State::ci, CallInfo::func, and lua_State::top.

Referenced by andaux(), aux_lines(), aux_lines(), aux_lines(), auxresume(), auxresume(), auxresume(), auxstatus(), b_or(), b_xor(), cleanupdb(), costatus(), db_busy_callback(), db_busy_handler(), db_commit_hook(), db_commit_hook_callback(), db_errorfb(), db_exec_callback(), db_progress_callback(), db_progress_handler(), db_rollback_hook(), db_rollback_hook_callback(), db_sql_finalize_function(), db_sql_normal_function(), db_trace(), db_trace_callback(), db_update_hook(), db_update_hook_callback(), dbvm_bind_values(), do_gsub(), docall(), docall(), docall(), docall(), dofilecont(), dofilecont(), dofilecont(), dotty(), dotty(), file_utime(), finishpcall(), finishpcall(), finishpcall(), g_read(), g_read(), g_read(), g_read(), g_write(), g_write(), g_write(), g_write(), io_lines(), l_print(), l_print(), ll_module(), loadline(), loadline(), luaB_assert(), luaB_assert(), luaB_assert(), luaB_assert(), luaB_auxwrap(), luaB_auxwrap(), luaB_auxwrap(), luaB_auxwrap(), luaB_coresume(), luaB_coresume(), luaB_coresume(), luaB_coresume(), luaB_costatus(), luaB_costatus(), luaB_dofile(), luaB_pcall(), luaB_pcall(), luaB_pcall(), luaB_pcall(), luaB_print(), luaB_print(), luaB_print(), luaB_print(), luaB_select(), luaB_select(), luaB_select(), luaB_select(), luaB_warn(), luaB_xpcall(), luaB_xpcall(), luaB_xpcall(), luaB_xpcall(), luaB_yield(), luaB_yield(), luaB_yield(), luaB_yield(), luaL_loadfile(), luaL_loadfilex(), luaL_traceback(), make_xml_object(), math_max(), math_max(), math_max(), math_max(), math_min(), math_min(), math_min(), math_min(), math_random(), math_random(), math_random(), math_random(), pack(), pack(), print(), pushglobalfuncname(), pushglobalfuncname(), pushglobalfuncname(), str_char(), str_char(), str_char(), str_char(), str_format(), str_format(), str_format(), str_format(), tinsert(), tinsert(), tinsert(), tinsert(), tpack(), utfchar(), utfchar(), Xml_eval(), and Xml_pushEncode().

◆ lua_getupvalue()

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

Definition at line 1057 of file lua-5.1.5/src/lapi.c.

1057 {
1058 const char *name;
1059 TValue *val;
1060 lua_lock(L);
1061 name = aux_upvalue(index2adr(L, funcindex), n, &val);
1062 if (name) {
1063 setobj2s(L, L->top, val);
1064 api_incr_top(L);
1065 }
1066 lua_unlock(L);
1067 return name;
1068}
static const char * aux_upvalue(StkId fi, int n, TValue **val)

References api_incr_top, aux_upvalue(), aux_upvalue(), aux_upvalue(), aux_upvalue(), index2addr(), index2addr(), index2adr(), index2value(), lua_lock, lua_unlock, name, NULL, setobj2s, and lua_State::top.

Referenced by auxupvalue(), auxupvalue(), auxupvalue(), auxupvalue(), and checkupval().

◆ lua_iscfunction()

LUA_API int lua_iscfunction ( lua_State * L,
int idx )

◆ lua_isinteger()

◆ lua_isnumber()

LUA_API int lua_isnumber ( lua_State * L,
int idx )

◆ lua_isstring()

◆ lua_isuserdata()

LUA_API int lua_isuserdata ( lua_State * L,
int idx )

Definition at line 273 of file lua-5.1.5/src/lapi.c.

273 {
274 const TValue *o = index2adr(L, idx);
275 return (ttisuserdata(o) || ttislightuserdata(o));
276}
#define ttislightuserdata(o)
#define ttisuserdata(o)

References index2addr(), index2addr(), index2adr(), index2value(), ttisfulluserdata, ttislightuserdata, and ttisuserdata.

Referenced by Xml_eval().

◆ lua_isyieldable()

LUA_API int lua_isyieldable ( lua_State * L)

Definition at line 687 of file lua-5.3.6/src/ldo.c.

687 {
688 return (L->nny == 0);
689}

References lua_State::nny, and yieldable.

Referenced by luaB_yieldable(), and luaB_yieldable().

◆ lua_len()

LUA_API void lua_len ( lua_State * L,
int idx )

Definition at line 1147 of file lua-5.2.4/src/lapi.c.

1147 {
1148 StkId t;
1149 lua_lock(L);
1150 t = index2addr(L, idx);
1151 luaV_objlen(L, L->top, t);
1152 api_incr_top(L);
1153 lua_unlock(L);
1154}
void luaV_objlen(lua_State *L, StkId ra, const TValue *rb)

References api_incr_top, index2addr(), index2addr(), index2value(), lua_lock, lua_unlock, luaV_objlen(), and lua_State::top.

Referenced by luaL_len().

◆ lua_load()

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

Definition at line 973 of file lua-5.2.4/src/lapi.c.

974 {
975 ZIO z;
976 int status;
977 lua_lock(L);
978 if (!chunkname) chunkname = "?";
979 luaZ_init(L, &z, reader, data);
980 status = luaD_protectedparser(L, &z, chunkname, mode);
981 if (status == LUA_OK) { /* no errors? */
982 LClosure *f = clLvalue(L->top - 1); /* get newly created function */
983 if (f->nupvalues == 1) { /* does it have one upvalue? */
984 /* get global table from registry */
985 Table *reg = hvalue(&G(L)->l_registry);
986 const TValue *gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
987 /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */
988 setobj(L, f->upvals[0]->v, gt);
989 luaC_barrier(L, f->upvals[0], gt);
990 }
991 }
992 lua_unlock(L);
993 return status;
994}
int luaD_protectedparser(lua_State *L, ZIO *z, const char *name)
#define luaC_barrier(L, p, v)
#define setobj(L, obj1, obj2)
void luaZ_init(lua_State *L, ZIO *z, lua_Reader reader, void *data)
#define clLvalue(o)
static const char * reader(lua_State *L, void *ud, size_t *size)

References clLvalue, G, getGtable, gt, hvalue, lua_lock, LUA_OK, LUA_RIDX_GLOBALS, lua_unlock, luaC_barrier, luaC_upvalbarrier, luaD_protectedparser(), luaH_getint(), luaZ_init(), reader(), s2v, setobj, lua_State::top, LClosure::upvals, and UpVal::v.

◆ lua_newstate()

LUA_API lua_State * lua_newstate ( lua_Alloc f,
void * ud )

Definition at line 143 of file lua-5.1.5/src/lstate.c.

143 {
144 int i;
145 lua_State *L;
146 global_State *g;
147 void *l = (*f)(ud, NULL, 0, state_size(LG));
148 if (l == NULL) return NULL;
149 L = tostate(l);
150 g = &((LG *)L)->g;
151 L->next = NULL;
152 L->tt = LUA_TTHREAD;
154 L->marked = luaC_white(g);
155 set2bits(L->marked, FIXEDBIT, SFIXEDBIT);
156 preinit_state(L, g);
157 g->frealloc = f;
158 g->ud = ud;
159 g->mainthread = L;
160 g->uvhead.u.l.prev = &g->uvhead;
161 g->uvhead.u.l.next = &g->uvhead;
162 g->GCthreshold = 0; /* mark it as unfinished state */
163 g->strt.size = 0;
164 g->strt.nuse = 0;
165 g->strt.hash = NULL;
167 luaZ_initbuffer(L, &g->buff);
168 g->panic = NULL;
169 g->gcstate = GCSpause;
170 g->rootgc = obj2gco(L);
171 g->sweepstrgc = 0;
172 g->sweepgc = &g->rootgc;
173 g->gray = NULL;
174 g->grayagain = NULL;
175 g->weak = NULL;
176 g->tmudata = NULL;
177 g->totalbytes = sizeof(LG);
180 g->gcdept = 0;
181 for (i=0; i<NUM_TAGS; i++) g->mt[i] = NULL;
182 if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) {
183 /* memory allocation error: free partial state */
184 close_state(L);
185 L = NULL;
186 }
187 else
189 return L;
190}
#define bit2mask(b1, b2)
#define WHITE0BIT
#define FIXEDBIT
#define SFIXEDBIT
#define set2bits(x, b1, b2)
#define luaC_white(g)
#define NUM_TAGS
#define state_size(x)
#define tostate(l)
static void f_luaopen(lua_State *L, void *ud)
static void preinit_state(lua_State *L, global_State *g)
struct LG LG
#define obj2gco(v)
#define registry(L)
#define LUA_TTHREAD
#define luai_userstateopen(L)
#define LUAI_GCPAUSE
#define LUAI_GCMUL
#define luaZ_initbuffer(L, buff)
struct UpVal * prev
union UpVal::@48 u
struct UpVal * next
struct UpVal::@48::@49 l
struct lua_State * mainthread
lua_CFunction panic
struct Table * mt[NUM_TAGS]

References global_State::allgc, global_State::allweak, bit2mask, bitmask, global_State::buff, cast, close_state(), close_state(), close_state(), close_state(), global_State::currentwhite, global_State::ephemeron, f_luaopen(), f_luaopen(), f_luaopen(), f_luaopen(), global_State::finobj, global_State::finobjold1, global_State::finobjrold, global_State::finobjsur, global_State::firstold1, FIXEDBIT, global_State::fixedgc, global_State::frealloc, LG::g, global_State::GCdebt, global_State::gcdept, global_State::gcemergency, global_State::GCestimate, global_State::gcfinnum, global_State::gckind, global_State::gcmajorinc, global_State::gcpause, global_State::gcrunning, GCSpause, global_State::gcstate, global_State::gcstepmul, global_State::gcstepsize, global_State::gcstopem, global_State::GCthreshold, global_State::genmajormul, global_State::genminormul, global_State::gray, global_State::grayagain, stringtable::hash, incnny, KGC_INC, KGC_NORMAL, UpVal::l, LG::l, global_State::l_registry, global_State::lastatomic, LUA_NUMTAGS, LUA_OK, LUA_TTHREAD, LUA_VTHREAD, luaC_white, luaD_rawrunprotected(), LUAI_GCMAJOR, LUAI_GCMUL, LUAI_GCPAUSE, LUAI_GCSTEPSIZE, LUAI_GENMAJORMUL, LUAI_GENMINORMUL, luai_makeseed, luai_userstateopen, luaZ_initbuffer, global_State::mainthread, makeseed(), makeseed(), global_State::mt, UpVal::next, global_State::nilvalue, NULL, NUM_TAGS, stringtable::nuse, obj2gco, global_State::old1, global_State::panic, preinit_state(), preinit_state(), preinit_thread(), preinit_thread(), UpVal::prev, global_State::reallyold, registry, global_State::rootgc, global_State::seed, set2bits, setgcparam, setivalue, setnilvalue, SFIXEDBIT, stringtable::size, state_size, global_State::strt, global_State::survival, global_State::sweepfin, global_State::sweepgc, global_State::sweepstrgc, global_State::tmudata, global_State::tobefnz, tostate, global_State::totalbytes, global_State::twups, UpVal::u, global_State::ud, global_State::ud_warn, global_State::uvhead, global_State::version, global_State::warnf, global_State::weak, and WHITE0BIT.

Referenced by luai_makeseed(), luaL_newstate(), makeseed(), and makeseed().

◆ lua_newthread()

◆ lua_newuserdatauv()

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

Definition at line 1335 of file lua-5.4.3/src/lapi.c.

1335 {
1336 Udata *u;
1337 lua_lock(L);
1338 api_check(L, 0 <= nuvalue && nuvalue < USHRT_MAX, "invalid value");
1339 u = luaS_newudata(L, size, nuvalue);
1340 setuvalue(L, s2v(L->top), u);
1341 api_incr_top(L);
1342 luaC_checkGC(L);
1343 lua_unlock(L);
1344 return getudatamem(u);
1345}
#define setuvalue(L, obj, x)
Udata * luaS_newudata(lua_State *L, size_t s, Table *e)
#define getudatamem(u)

References api_check, api_incr_top, getudatamem, lua_lock, lua_unlock, luaC_checkGC, luaS_newudata(), s2v, setuvalue, and lua_State::top.

Referenced by gmatch(), newbox(), newprefile(), and setrandfunc().

◆ lua_next()

LUA_API int lua_next ( lua_State * L,
int idx )

Definition at line 973 of file lua-5.1.5/src/lapi.c.

973 {
974 StkId t;
975 int more;
976 lua_lock(L);
977 t = index2adr(L, idx);
978 api_check(L, ttistable(t));
979 more = luaH_next(L, hvalue(t), L->top - 1);
980 if (more) {
981 api_incr_top(L);
982 }
983 else /* no more elements */
984 L->top -= 1; /* remove key */
985 lua_unlock(L);
986 return more;
987}
#define ttistable(o)
int luaH_next(lua_State *L, Table *t, StkId key)

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

Referenced by cleanupdb(), db_close_vm(), findfield(), findfield(), findfield(), foreach(), luaB_next(), luaB_next(), luaB_next(), luaB_next(), maxn(), Xml_pushDecode(), Xml_pushEncode(), and Xml_str().

◆ 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 948 of file lua-5.3.6/src/lapi.c.

949 {
950 struct CallS c;
951 int status;
952 ptrdiff_t func;
953 lua_lock(L);
954 api_check(L, k == NULL || !isLua(L->ci),
955 "cannot use continuations inside hooks");
956 api_checknelems(L, nargs+1);
957 api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread");
958 checkresults(L, nargs, nresults);
959 if (errfunc == 0)
960 func = 0;
961 else {
962 StkId o = index2addr(L, errfunc);
963 api_checkstackindex(L, errfunc, o);
964 func = savestack(L, o);
965 }
966 c.func = L->top - (nargs+1); /* function to be called */
967 if (k == NULL || L->nny > 0) { /* no continuation or no yieldable? */
968 c.nresults = nresults; /* do a 'conventional' protected call */
969 status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func);
970 }
971 else { /* prepare continuation (call is already protected by 'resume') */
972 CallInfo *ci = L->ci;
973 ci->u.c.k = k; /* save continuation */
974 ci->u.c.ctx = ctx; /* save context */
975 /* save information for error recovery */
976 ci->extra = savestack(L, c.func);
977 ci->u.c.old_errfunc = L->errfunc;
978 L->errfunc = func;
979 setoah(ci->callstatus, L->allowhook); /* save value of 'allowhook' */
980 ci->callstatus |= CIST_YPCALL; /* function can do error recovery */
981 luaD_call(L, c.func, nresults); /* do the call */
982 ci->callstatus &= ~CIST_YPCALL;
983 L->errfunc = ci->u.c.old_errfunc;
984 status = LUA_OK; /* if it is here, there were no errors */
985 }
987 lua_unlock(L);
988 return status;
989}
int luaD_pcall(lua_State *L, Pfunc func, void *u, ptrdiff_t old_top, ptrdiff_t ef)
#define savestack(L, p)
#define CIST_YPCALL
#define api_checkstackindex(l, i, o)
static void f_call(lua_State *L, void *ud)
#define setoah(st, v)
ptrdiff_t old_errfunc

References adjustresults, lua_State::allowhook, api_check, api_checknelems, api_checkstackindex, CallInfo::c, CallInfo::callstatus, cast_int, checkresults, lua_State::ci, CIST_YPCALL, CallInfo::ctx, lua_State::errfunc, CallInfo::extra, f_call(), f_call(), CallS::func, CallInfo::funcidx, index2addr(), index2stack(), isLua, CallInfo::k, lua_lock, LUA_OK, lua_unlock, luaD_call(), luaD_pcall(), lua_State::nny, CallS::nresults, NULL, CallInfo::old_errfunc, s2v, savestack, setoah, lua_State::status, lua_State::top, ttisfunction, CallInfo::u, CallInfo::u2, and yieldable.

◆ lua_pushboolean()

LUA_API void lua_pushboolean ( lua_State * L,
int b )

Definition at line 503 of file lua-5.1.5/src/lapi.c.

503 {
504 lua_lock(L);
505 setbvalue(L->top, (b != 0)); /* ensure that true is 1 */
506 api_incr_top(L);
507 lua_unlock(L);
508}
#define setbvalue(obj, x)

References api_incr_top, lua_lock, lua_unlock, s2v, setbfvalue, setbtvalue, setbvalue, and lua_State::top.

Referenced by aux_lines(), aux_lines(), aux_lines(), aux_lines(), b_test(), change_dir(), db_getuservalue(), db_isopen(), db_load_extension(), db_register_function(), db_setmetatable(), dbvm_isopen(), file_lock(), file_unlock(), find_on_match(), finishpcall(), finishpcall(), finishpcall(), lfs_g_setmode(), ll_loadfunc(), ll_require(), ll_require(), ll_require(), ll_require(), lookforfunc(), lookforfunc(), lsqlite_complete(), luaB_close(), luaB_collectgarbage(), luaB_collectgarbage(), luaB_collectgarbage(), luaB_collectgarbage(), luaB_coresume(), luaB_coresume(), luaB_coresume(), luaB_coresume(), luaB_corunning(), luaB_corunning(), luaB_corunning(), luaB_newproxy(), luaB_pcall(), luaB_pcall(), luaB_pcall(), luaB_rawequal(), luaB_rawequal(), luaB_rawequal(), luaB_rawequal(), luaB_xpcall(), luaB_xpcall(), luaB_xpcall(), luaB_yieldable(), luaB_yieldable(), luaL_execresult(), luaL_fileresult(), luaL_setfuncs(), math_ult(), math_ult(), os_execute(), os_execute(), os_execute(), os_pushresult(), pmain(), pmain(), pmain(), pushresult(), pushresult(), setboolfield(), setboolfield(), setboolfield(), setboolfield(), settabsb(), settabsb(), settabsb(), Xml_find(), and Xml_iterate().

◆ lua_pushcclosure()

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

Definition at line 486 of file lua-5.1.5/src/lapi.c.

486 {
487 Closure *cl;
488 lua_lock(L);
489 luaC_checkGC(L);
490 api_checknelems(L, n);
491 cl = luaF_newCclosure(L, n, getcurrenv(L));
492 cl->c.f = fn;
493 L->top -= n;
494 while (n--)
495 setobj2n(L, &cl->c.upvalue[n], L->top+n);
496 setclvalue(L, L->top, cl);
498 api_incr_top(L);
499 lua_unlock(L);
500}
static Table * getcurrenv(lua_State *L)
Closure * luaF_newCclosure(lua_State *L, int nelems, Table *e)
#define iswhite(x)
#define setobj2n
lua_CFunction f

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

Referenced by aux_lines(), aux_lines(), aux_lines(), aux_lines(), auxopen(), base_open(), createsearcherstable(), createsearcherstable(), createsearcherstable(), gmatch(), gmatch(), gmatch(), gmatch(), luaB_cowrap(), luaB_cowrap(), luaB_cowrap(), luaB_cowrap(), luaI_openlib(), luaL_setfuncs(), and Xml_find().

◆ lua_pushfstring()

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

Definition at line 473 of file lua-5.1.5/src/lapi.c.

473 {
474 const char *ret;
475 va_list argp;
476 lua_lock(L);
477 luaC_checkGC(L);
478 va_start(argp, fmt);
479 ret = luaO_pushvfstring(L, fmt, argp);
480 va_end(argp);
481 lua_unlock(L);
482 return ret;
483}
const char * luaO_pushvfstring(lua_State *L, const char *fmt, va_list argp)

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

Referenced by _file_info_(), addreturn(), addreturn(), auxresume(), change_dir(), checkoption(), checkoption(), checkoption(), controloptions(), db_errorfb(), db_getinfo(), db_getinfo(), db_getinfo(), db_getinfo(), db_last_insert_rowid(), db_tostring(), db_update_hook_callback(), dbvm_last_insert_rowid(), dbvm_tostring(), dotty(), dotty(), errfile(), errfile(), errfile(), errfile(), f_tostring(), f_tostring(), f_tostring(), file_lock(), file_unlock(), fileerror(), findfile(), io_tostring(), l_print(), l_print(), lcontext_tostring(), ll_register(), loader_Croot(), loader_preload(), loadfunc(), loadfunc(), loadfunc(), luaB_tostring(), luaL_checkoption(), luaL_checkoption(), luaL_fileresult(), luaL_loadfile(), luaL_loadfilex(), luaL_tolstring(), luaL_traceback(), luaL_typeerror(), luaL_typerror(), luaL_where(), mkfuncname(), msghandler(), msghandler(), os_pushresult(), pusherror(), pushfuncname(), pushfuncname(), pushfuncname(), pushline(), pushline(), pushline(), pushline(), pushresult(), pushutfchar(), pushutfchar(), searcher_Croot(), searcher_Croot(), searcher_Croot(), searcher_preload(), searcher_preload(), searcher_preload(), searchpath(), searchpath(), setpath(), setpath(), typeerror(), typeerror(), and Xml_str().

◆ lua_pushinteger()

LUA_API void lua_pushinteger ( lua_State * L,
lua_Integer n )

Definition at line 437 of file lua-5.1.5/src/lapi.c.

437 {
438 lua_lock(L);
439 setnvalue(L->top, cast_num(n));
440 api_incr_top(L);
441 lua_unlock(L);
442}
#define cast_num(i)

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

Referenced by _file_info_(), aux_lines(), aux_lines(), aux_lines(), b_size(), b_unpack(), byteoffset(), byteoffset(), cleanupbu(), cleanupvm(), codepoint(), codepoint(), db_busy_callback(), db_changes(), db_close(), db_errcode(), db_exec(), db_exec_callback(), db_gethook(), db_gethook(), db_gethook(), db_gethook(), db_prepare(), db_setcstacklimit(), db_total_changes(), db_update_hook_callback(), dbbu_pagecount(), dbbu_remaining(), dbbu_step(), dbvm_bind(), dbvm_bind_blob(), dbvm_bind_names(), dbvm_bind_parameter_count(), dbvm_bind_values(), dbvm_columns(), dbvm_reset(), dbvm_step(), f_seek(), f_seek(), f_seek(), foreachi(), get_onecapture(), getn(), gmatch(), gmatch(), gmatch_aux(), gmatch_aux(), hookf(), hookf(), hookf(), hookf(), ipairsaux(), ipairsaux(), ipairsaux(), ipairsaux(), iter_aux(), iter_aux(), iter_codes(), iter_codes(), lcontext_aggregate_count(), lsqlite_do_open(), luaB_collectgarbage(), luaB_collectgarbage(), luaB_collectgarbage(), luaB_gcinfo(), luaB_ipairs(), luaB_ipairs(), luaB_ipairs(), luaB_rawlen(), luaB_rawlen(), luaB_rawlen(), luaB_select(), luaB_select(), luaB_select(), luaB_select(), luaB_tonumber(), luaB_tonumber(), luaL_execresult(), luaL_fileresult(), luaL_ref(), luaL_unref(), luaopen_lsqlite3(), luaopen_LuaXML_lib(), luaopen_math(), main(), main(), math_abs(), math_abs(), math_fmod(), math_fmod(), math_frexp(), math_frexp(), math_random(), math_random(), math_toint(), math_toint(), os_execute(), os_pushresult(), pack(), pack(), pairsmeta(), pairsmeta(), push_onecapture(), push_onecapture(), push_onecapture(), push_st_atime(), push_st_blksize(), push_st_blocks(), push_st_ctime(), push_st_dev(), push_st_gid(), push_st_ino(), push_st_mtime(), push_st_nlink(), push_st_rdev(), push_st_size(), push_st_uid(), push_TAG_key(), pusherror(), pushnumint(), pushnumint(), pushresult(), setfield(), setfield(), setfield(), setfield(), setseed(), settabsi(), settabsi(), settabsi(), settabsi(), str_byte(), str_byte(), str_byte(), str_byte(), str_find_aux(), str_find_aux(), str_find_aux(), str_find_aux(), str_gsub(), str_gsub(), str_gsub(), str_gsub(), str_len(), str_len(), str_len(), str_len(), str_packsize(), str_packsize(), str_unpack(), str_unpack(), tpack(), traceback(), utflen(), utflen(), Xml_iterate(), and Xml_str().

◆ lua_pushlightuserdata()

◆ lua_pushlstring()

◆ lua_pushnil()

LUA_API void lua_pushnil ( lua_State * L)

Definition at line 421 of file lua-5.1.5/src/lapi.c.

421 {
422 lua_lock(L);
423 setnilvalue(L->top);
424 api_incr_top(L);
425 lua_unlock(L);
426}

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

Referenced by _file_info_(), b_pack(), byteoffset(), change_dir(), cleanupbu(), cleanupdb(), cleanupvm(), db_close_vm(), db_exec(), db_gethook(), db_getinfo(), db_getinfo(), db_getinfo(), db_getlocal(), db_getlocal(), db_getlocal(), db_getmetatable(), db_getmetatable(), db_getmetatable(), db_getmetatable(), db_getuservalue(), db_getuservalue(), db_prepare(), db_push_value(), db_sql_finalize_function(), dir_iter(), dir_iter_factory(), file_lock(), file_unlock(), findfield(), findfield(), findfield(), foreach(), g_read(), g_read(), g_read(), get_dir(), hookf(), hookf(), hookf(), hookf(), io_lines(), io_lines(), io_lines(), io_noclose(), io_noclose(), io_noclose(), io_type(), io_type(), io_type(), lfs_g_setmode(), lfs_lock_dir(), ll_loadlib(), ll_loadlib(), ll_loadlib(), ll_searchpath(), ll_searchpath(), load_aux(), load_aux(), load_aux(), lsqlite_do_open(), lua_pushstring(), luaB_corunning(), luaB_getmetatable(), luaB_getmetatable(), luaB_getmetatable(), luaB_getmetatable(), luaB_next(), luaB_next(), luaB_next(), luaB_next(), luaB_pairs(), luaB_pairs(), luaB_pcall(), luaB_tonumber(), luaB_tonumber(), luaB_tonumber(), luaL_execresult(), luaL_fileresult(), make_link(), math_toint(), math_type(), maxn(), os_date(), os_date(), os_pushresult(), os_time(), os_time(), pairsmeta(), pairsmeta(), pusherror(), pushresult(), read_number(), read_number(), read_number(), read_number(), str_find_aux(), str_find_aux(), str_find_aux(), str_pack(), str_pack(), tremove(), tremove(), tremove(), tremove(), utflen(), vm_push_column(), Xml_pushDecode(), Xml_pushEncode(), and Xml_str().

◆ lua_pushnumber()

LUA_API void lua_pushnumber ( lua_State * L,
lua_Number n )

Definition at line 429 of file lua-5.1.5/src/lapi.c.

429 {
430 lua_lock(L);
431 setnvalue(L->top, n);
432 api_incr_top(L);
433 lua_unlock(L);
434}

References api_incr_top, lua_lock, lua_unlock, luaG_runerror(), luai_checknum, s2v, setfltvalue, setnvalue, and lua_State::top.

Referenced by b_unpack(), db_push_value(), f_seek(), luaB_collectgarbage(), luaB_collectgarbage(), luaB_collectgarbage(), luaB_collectgarbage(), luaB_tonumber(), luaB_tonumber(), luaL_checkversion_(), luaopen_math(), math_abs(), math_abs(), math_abs(), math_abs(), math_acos(), math_acos(), math_acos(), math_acos(), math_asin(), math_asin(), math_asin(), math_asin(), math_atan(), math_atan(), math_atan(), math_atan(), math_atan2(), math_atan2(), math_ceil(), math_ceil(), math_cos(), math_cos(), math_cos(), math_cos(), math_cosh(), math_cosh(), math_deg(), math_deg(), math_deg(), math_deg(), math_exp(), math_exp(), math_exp(), math_exp(), math_floor(), math_floor(), math_fmod(), math_fmod(), math_fmod(), math_fmod(), math_frexp(), math_frexp(), math_ldexp(), math_ldexp(), math_log(), math_log(), math_log(), math_log(), math_log10(), math_max(), math_max(), math_min(), math_min(), math_modf(), math_modf(), math_modf(), math_modf(), math_pow(), math_pow(), math_rad(), math_rad(), math_rad(), math_rad(), math_random(), math_random(), math_random(), math_random(), math_sin(), math_sin(), math_sin(), math_sin(), math_sinh(), math_sinh(), math_sqrt(), math_sqrt(), math_sqrt(), math_sqrt(), math_tan(), math_tan(), math_tan(), math_tan(), math_tanh(), math_tanh(), maxn(), os_clock(), os_clock(), os_clock(), os_clock(), os_difftime(), os_difftime(), os_difftime(), os_difftime(), os_time(), os_time(), pushnumint(), pushnumint(), read_number(), read_number(), str_unpack(), str_unpack(), and vm_push_column().

◆ lua_pushstring()

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

Definition at line 454 of file lua-5.1.5/src/lapi.c.

454 {
455 if (s == NULL)
456 lua_pushnil(L);
457 else
458 lua_pushlstring(L, s, strlen(s));
459}
LUA_API void lua_pushnil(lua_State *L)
LUA_API void lua_pushlstring(lua_State *L, const char *s, size_t len)

References api_incr_top, getstr, lua_lock, lua_pushlstring(), lua_pushnil(), lua_unlock, luaC_checkGC, luaS_new, NULL, s, s2v, setnilvalue, setsvalue2s, and lua_State::top.

Referenced by _file_info_(), auxupvalue(), auxupvalue(), auxupvalue(), auxupvalue(), checkfield(), checkfield(), checkload(), checkload(), checkload(), create_meta(), createargtable(), createargtable(), db_db_filename(), db_do_next_row(), db_do_rows(), db_errmsg(), db_exec_callback(), db_gethook(), db_gethook(), db_gethook(), db_gethook(), db_getlocal(), db_getlocal(), db_getlocal(), db_getlocal(), db_load_extension(), db_prepare(), db_sethook(), db_sethook(), db_setlocal(), db_setlocal(), db_setlocal(), db_setlocal(), db_trace_callback(), db_update_hook_callback(), dbvm_bind_names(), dbvm_bind_parameter_name(), dbvm_get_name(), dbvm_get_named_types(), dbvm_get_named_values(), dbvm_get_names(), dbvm_get_type(), dbvm_get_types(), dbvm_get_unames(), dbvm_get_utypes(), dir_iter(), dolibrary(), dolibrary(), dolibrary(), dolibrary(), findloader(), findloader(), findloader(), finishpcall(), get_dir(), getargs(), getargs(), hookf(), hookf(), hookf(), hookf(), lfs_g_setmode(), lfs_lock_dir(), ll_loadlib(), ll_loadlib(), ll_loadlib(), ll_loadlib(), ll_require(), ll_require(), ll_require(), lsqlite_do_open(), lsqlite_lversion(), lsqlite_temp_directory(), lsqlite_version(), luaB_costatus(), luaB_costatus(), luaB_tostring(), luaB_type(), luaB_type(), luaB_type(), luaB_type(), luaL_execresult(), luaL_fileresult(), luaL_getmetafield(), luaL_newmetatable(), luaL_openlibs(), luaL_requiref(), luaL_tolstring(), luaopen_lsqlite3(), make_link(), math_type(), mg_start2(), modinit(), os_getenv(), os_getenv(), os_getenv(), os_getenv(), os_setlocale(), os_setlocale(), os_setlocale(), os_setlocale(), os_tmpname(), os_tmpname(), os_tmpname(), os_tmpname(), push_st_mode(), push_st_perm(), pusherror(), pushglobalfuncname(), pushglobalfuncname(), pushline(), pushline(), pushmode(), searcher_Croot(), searcher_Croot(), searcher_Croot(), searchpath(), setpath(), setpath(), setpath(), setpath(), settabss(), settabss(), settabss(), settabss(), and Xml_eval().

◆ lua_pushthread()

LUA_API int lua_pushthread ( lua_State * L)

◆ lua_pushvalue()

LUA_API void lua_pushvalue ( lua_State * L,
int idx )

Definition at line 228 of file lua-5.1.5/src/lapi.c.

228 {
229 lua_lock(L);
230 setobj2s(L, L->top, index2adr(L, idx));
231 api_incr_top(L);
232 lua_unlock(L);
233}

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

Referenced by add_value(), add_value(), add_value(), add_value(), addtoclib(), addtoclib(), aux_lines(), aux_lines(), aux_lines(), auxsort(), auxsort(), auxsort(), auxsort(), base_open(), checkupval(), create_meta(), createmeta(), createmeta(), createmeta(), createmetatable(), createmetatable(), createmetatable(), createmetatable(), createsearcherstable(), createsearcherstable(), createsearcherstable(), createstdfile(), createstdfile(), createstdfile(), createstdfile(), db_exec_callback(), db_getinfo(), db_getinfo(), db_getinfo(), db_getinfo(), db_getlocal(), db_getlocal(), db_getlocal(), db_getlocal(), db_getregistry(), db_getregistry(), db_getregistry(), db_getregistry(), db_register_function(), db_sethook(), db_sethook(), db_sethook(), db_sethook(), db_sql_finalize_function(), db_sql_normal_function(), db_traceback(), db_traceback(), db_traceback(), dbvm_do_rows(), dir_iter_factory(), dooptions(), f_write(), f_write(), f_write(), finishpcall(), finishpcall(), foreach(), foreachi(), g_iofile(), g_iofile(), g_iofile(), g_iofile(), generic_reader(), generic_reader(), generic_reader(), generic_reader(), getfunc(), gethooktable(), io_lines(), io_readline(), io_readline(), io_readline(), io_readline(), iter_codes(), iter_codes(), ll_addtoclib(), ll_module(), ll_register(), ll_require(), ll_require(), ll_require(), ll_require(), ll_seeall(), load_aux(), load_aux(), load_aux(), lsqlite_backup_init(), luaB_cocreate(), luaB_cocreate(), luaB_cocreate(), luaB_cocreate(), luaB_error(), luaB_error(), luaB_error(), luaB_error(), luaB_getfenv(), luaB_ipairs(), luaB_ipairs(), luaB_ipairs(), luaB_newproxy(), luaB_pairs(), luaB_pairs(), luaB_print(), luaB_print(), luaB_print(), luaB_setfenv(), luaB_tostring(), luaB_xpcall(), luaB_xpcall(), luaB_xpcall(), luaI_openlib(), luaL_callmeta(), luaL_findtable(), luaL_getsubtable(), luaL_newmetatable(), luaL_requiref(), luaL_setfuncs(), luaL_tolstring(), luaopen_base(), luaopen_lfs(), luaopen_lsqlite3(), luaopen_LuaXML_lib(), luaopen_package(), luaopen_struct(), math_max(), math_max(), math_min(), math_min(), modinit(), newvm(), pack(), pairsmeta(), pairsmeta(), setfenv(), setn(), sort_comp(), sort_comp(), sort_comp(), sort_comp(), str_format(), str_gsub(), tmove(), tmove(), tonum(), traceback(), treatstackoption(), treatstackoption(), Xml_append(), Xml_eval(), Xml_find(), Xml_iterate(), Xml_match(), Xml_new(), Xml_pushEncode(), Xml_str(), and Xml_tag().

◆ lua_pushvfstring()

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

Definition at line 462 of file lua-5.1.5/src/lapi.c.

463 {
464 const char *ret;
465 lua_lock(L);
466 luaC_checkGC(L);
467 ret = luaO_pushvfstring(L, fmt, argp);
468 lua_unlock(L);
469 return ret;
470}

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

Referenced by luaL_error().

◆ lua_rawequal()

LUA_API int lua_rawequal ( lua_State * L,
int idx1,
int idx2 )

Definition at line 279 of file lua-5.1.5/src/lapi.c.

279 {
280 StkId o1 = index2adr(L, index1);
281 StkId o2 = index2adr(L, index2);
282 return (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0
283 : luaO_rawequalObj(o1, o2);
284}
int luaO_rawequalObj(const TValue *t1, const TValue *t2)
#define luaO_nilobject

References index2addr(), index2addr(), index2adr(), index2value(), isvalid, luaO_nilobject, luaO_rawequalObj(), and luaV_rawequalobj.

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

◆ lua_rawget()

◆ lua_rawgeti()

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

Definition at line 658 of file lua-5.3.6/src/lapi.c.

658 {
659 StkId t;
660 lua_lock(L);
661 t = index2addr(L, idx);
662 api_check(L, ttistable(t), "table expected");
663 setobj2s(L, L->top, luaH_getint(hvalue(t), n));
664 api_incr_top(L);
665 lua_unlock(L);
666 return ttnov(L->top - 1);
667}

References api_check, api_incr_top, finishrawget(), gettable(), hvalue, index2addr(), lua_lock, lua_unlock, luaH_getint(), setobj2s, lua_State::top, ttistable, and ttnov.

◆ lua_rawgetp()

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

Definition at line 660 of file lua-5.2.4/src/lapi.c.

660 {
661 StkId t;
662 TValue k;
663 lua_lock(L);
664 t = index2addr(L, idx);
665 api_check(L, ttistable(t), "table expected");
666 setpvalue(&k, cast(void *, p));
667 setobj2s(L, L->top, luaH_get(hvalue(t), &k));
668 api_incr_top(L);
669 lua_unlock(L);
670}

References api_check, api_incr_top, cast, cast_voidp, finishrawget(), gettable(), hvalue, index2addr(), index2addr(), lua_lock, lua_unlock, luaH_get(), setobj2s, setpvalue, lua_State::top, ttistable, and ttnov.

Referenced by addtoclib(), checkclib(), db_gethook(), db_sethook(), and hookf().

◆ lua_rawlen()

LUA_API lua_Unsigned lua_rawlen ( lua_State * L,
int idx )

Definition at line 407 of file lua-5.2.4/src/lapi.c.

407 {
408 StkId o = index2addr(L, idx);
409 switch (ttypenv(o)) {
410 case LUA_TSTRING: return tsvalue(o)->len;
411 case LUA_TUSERDATA: return uvalue(o)->len;
412 case LUA_TTABLE: return luaH_getn(hvalue(o));
413 default: return 0;
414 }
415}
#define tsvalue(o)
int luaH_getn(Table *t)
#define ttypenv(o)

References hvalue, index2addr(), index2addr(), index2value(), LUA_TLNGSTR, LUA_TSHRSTR, LUA_TSTRING, LUA_TTABLE, LUA_TUSERDATA, LUA_VLNGSTR, LUA_VSHRSTR, LUA_VTABLE, LUA_VUSERDATA, luaH_getn(), tsvalue, ttype, ttypenv, ttypetag, and uvalue.

◆ lua_rawset()

◆ lua_rawseti()

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

Definition at line 817 of file lua-5.3.6/src/lapi.c.

817 {
818 StkId o;
819 lua_lock(L);
820 api_checknelems(L, 1);
821 o = index2addr(L, idx);
822 api_check(L, ttistable(o), "table expected");
823 luaH_setint(L, hvalue(o), n, L->top - 1);
824 luaC_barrierback(L, hvalue(o), L->top-1);
825 L->top--;
826 lua_unlock(L);
827}
#define luaC_barrierback(L, p, v)
void luaH_setint(lua_State *L, Table *t, int key, TValue *value)

References api_check, api_checknelems, gettable(), hvalue, index2addr(), lua_lock, lua_unlock, luaC_barrierback, luaH_setint(), obj2gco, s2v, lua_State::top, and ttistable.

◆ lua_rawsetp()

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

Definition at line 797 of file lua-5.2.4/src/lapi.c.

797 {
798 StkId t;
799 TValue k;
800 lua_lock(L);
801 api_checknelems(L, 1);
802 t = index2addr(L, idx);
803 api_check(L, ttistable(t), "table expected");
804 setpvalue(&k, cast(void *, p));
805 setobj2t(L, luaH_set(L, hvalue(t), &k), L->top - 1);
806 luaC_barrierback(L, gcvalue(t), L->top - 1);
807 L->top--;
808 lua_unlock(L);
809}
#define gcvalue(o)

References api_check, api_checknelems, aux_rawset(), cast, cast_voidp, gcvalue, hvalue, index2addr(), index2addr(), lua_lock, lua_unlock, luaC_barrierback, luaH_set(), setobj2t, setpvalue, lua_State::top, and ttistable.

Referenced by createclibstable(), and db_sethook().

◆ lua_resetthread()

LUA_API int lua_resetthread ( lua_State * L)

Definition at line 345 of file lua-5.4.3/src/lstate.c.

345 {
346 int status;
347 lua_lock(L);
348 status = luaE_resetthread(L, L->status);
349 lua_unlock(L);
350 return status;
351}
int luaE_resetthread(lua_State *L, int status)

References lua_lock, lua_unlock, luaE_resetthread(), and lua_State::status.

Referenced by luaB_auxwrap(), and luaB_close().

◆ lua_resume()

LUA_API int lua_resume ( lua_State * L,
lua_State * from,
int narg,
int * nres )

Definition at line 773 of file lua-5.4.3/src/ldo.c.

774 {
775 int status;
776 lua_lock(L);
777 if (L->status == LUA_OK) { /* may be starting a coroutine */
778 if (L->ci != &L->base_ci) /* not in base level? */
779 return resume_error(L, "cannot resume non-suspended coroutine", nargs);
780 else if (L->top - (L->ci->func + 1) == nargs) /* no function? */
781 return resume_error(L, "cannot resume dead coroutine", nargs);
782 }
783 else if (L->status != LUA_YIELD) /* ended with errors? */
784 return resume_error(L, "cannot resume dead coroutine", nargs);
785 L->nCcalls = (from) ? getCcalls(from) : 0;
786 luai_userstateresume(L, nargs);
787 api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs);
788 status = luaD_rawrunprotected(L, resume, &nargs);
789 /* continue running after recoverable errors */
790 status = precover(L, status);
791 if (l_likely(!errorstatus(status)))
792 lua_assert(status == L->status); /* normal end or yield */
793 else { /* unrecoverable error */
794 L->status = cast_byte(status); /* mark thread as 'dead' */
795 luaD_seterrorobj(L, status, L->top); /* push error message */
796 L->ci->top = L->top;
797 }
798 *nresults = (status == LUA_YIELD) ? L->ci->u2.nyield
799 : cast_int(L->top - (L->ci->func + 1));
800 lua_unlock(L);
801 return status;
802}
#define cast_byte(i)
#define LUA_YIELD
#define luai_userstateresume(L, n)
void luaD_seterrorobj(lua_State *L, int errcode, StkId oldtop)
static int resume_error(lua_State *L, const char *msg, int narg)
static int precover(lua_State *L, int status)
#define errorstatus(s)
int luaD_rawrunprotected(lua_State *L, Pfunc f, void *ud)
static void resume(lua_State *L, void *ud)
#define getCcalls(L)
union CallInfo::@95 u2

References api_checknelems, lua_State::base_ci, cast_byte, cast_int, lua_State::ci, errorstatus, CallInfo::func, getCcalls, lua_assert, lua_lock, LUA_OK, lua_unlock, LUA_YIELD, luaD_rawrunprotected(), luaD_seterrorobj(), luai_userstateresume, lua_State::nCcalls, CallInfo::nyield, precover(), resume(), resume_error(), lua_longjmp::status, lua_State::status, CallInfo::top, lua_State::top, and CallInfo::u2.

◆ lua_rotate()

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

Definition at line 207 of file lua-5.3.6/src/lapi.c.

207 {
208 StkId p, t, m;
209 lua_lock(L);
210 t = L->top - 1; /* end of stack segment being rotated */
211 p = index2addr(L, idx); /* start of segment */
212 api_checkstackindex(L, idx, p);
213 api_check(L, (n >= 0 ? n : -n) <= (t - p + 1), "invalid 'n'");
214 m = (n >= 0 ? t - n : p - n - 1); /* end of prefix */
215 reverse(L, p, m); /* reverse the prefix with length 'n' */
216 reverse(L, m + 1, t); /* reverse the suffix */
217 reverse(L, p, t); /* reverse the entire segment */
218 lua_unlock(L);
219}
static void reverse(lua_State *L, StkId from, StkId to)

References api_check, api_checkstackindex, index2addr(), index2stack(), lua_lock, lua_unlock, reverse(), reverse(), and lua_State::top.

Referenced by aux_lines(), aux_lines(), db_getlocal(), db_getlocal(), ll_require(), luaB_xpcall(), luaB_xpcall(), treatstackoption(), and treatstackoption().

◆ lua_setallocf()

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

Definition at line 1017 of file lua-5.1.5/src/lapi.c.

1017 {
1018 lua_lock(L);
1019 G(L)->ud = ud;
1020 G(L)->frealloc = f;
1021 lua_unlock(L);
1022}

References G, lua_lock, lua_unlock, and CCallS::ud.

◆ lua_setcstacklimit()

LUA_API int lua_setcstacklimit ( lua_State * L,
unsigned int limit )

Definition at line 99 of file lua-5.4.3/src/lstate.c.

99 {
100 UNUSED(L); UNUSED(limit);
101 return LUAI_MAXCCALLS; /* warning?? */
102}
#define UNUSED(x)
#define LUAI_MAXCCALLS

References LUAI_MAXCCALLS, and UNUSED.

Referenced by db_setcstacklimit().

◆ lua_setfield()

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

Definition at line 657 of file lua-5.1.5/src/lapi.c.

657 {
658 StkId t;
659 TValue key;
660 lua_lock(L);
661 api_checknelems(L, 1);
662 t = index2adr(L, idx);
664 setsvalue(L, &key, luaS_new(L, k));
665 luaV_settable(L, t, &key, L->top - 1);
666 L->top--; /* pop value */
667 lua_unlock(L);
668}
#define luaV_settable(L, t, k, v)

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

Referenced by addtoclib(), addtoclib(), auxopen(), base_open(), createclibstable(), createclibstable(), createmeta(), createmeta(), createmeta(), createmeta(), createmetatable(), createmetatable(), createmetatable(), createmetatable(), createsearcherstable(), createsearcherstable(), createstdfile(), createstdfile(), createstdfile(), createstdfile(), db_getinfo(), db_sethook(), db_sethook(), db_sethook(), dir_create_meta(), g_iofile(), g_iofile(), g_iofile(), link_info(), ll_addtoclib(), ll_module(), ll_require(), ll_require(), ll_require(), ll_require(), ll_seeall(), lock_create_meta(), luaI_openlib(), luaL_getsubtable(), luaL_newmetatable(), luaL_openlibs(), luaL_requiref(), luaL_setfuncs(), luaopen_base(), luaopen_LuaXML_lib(), luaopen_math(), luaopen_package(), luaopen_string(), luaopen_utf8(), modinit(), newbox(), newfenv(), pack(), pack(), pmain(), pmain(), pmain(), set_info(), setboolfield(), setboolfield(), setboolfield(), setboolfield(), setfield(), setfield(), setfield(), setfield(), setpath(), setpath(), setpath(), setpath(), settabsb(), settabsb(), settabsb(), settabsi(), settabsi(), settabsi(), settabsi(), settabss(), settabss(), settabss(), settabss(), tpack(), treatstackoption(), treatstackoption(), treatstackoption(), and treatstackoption().

◆ lua_setglobal()

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

Definition at line 734 of file lua-5.2.4/src/lapi.c.

734 {
735 Table *reg = hvalue(&G(L)->l_registry);
736 const TValue *gt; /* global table */
737 lua_lock(L);
738 api_checknelems(L, 1);
740 setsvalue2s(L, L->top++, luaS_new(L, var));
741 luaV_settable(L, gt, L->top - 1, L->top - 2);
742 L->top -= 2; /* pop value and key */
743 lua_unlock(L);
744}

References api_checknelems, auxsetstr(), auxsetstr(), G, getGtable, gt, hvalue, lua_lock, LUA_RIDX_GLOBALS, lua_unlock, luaH_getint(), luaS_new, luaV_settable, name, setsvalue2s, and lua_State::top.

◆ lua_sethook()

LUA_API void lua_sethook ( lua_State * L,
lua_Hook func,
int mask,
int count )

Definition at line 56 of file lua-5.1.5/src/ldebug.c.

56 {
57 if (func == NULL || mask == 0) { /* turn off hooks? */
58 mask = 0;
59 func = NULL;
60 }
61 L->hook = func;
62 L->basehookcount = count;
65 return 1;
66}
#define resethookcount(L)
#define mask(n)

References lua_State::basehookcount, cast_byte, lua_State::ci, lua_State::hook, lua_State::hookmask, isLua, CallInfo::l, mask, NULL, lua_State::oldpc, resethookcount, CallInfo::savedpc, settraps(), and CallInfo::u.

Referenced by db_sethook(), db_sethook(), db_sethook(), db_sethook(), laction(), laction(), laction(), laction(), lstop(), lstop(), lstop(), and lstop().

◆ lua_seti()

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

Definition at line 783 of file lua-5.3.6/src/lapi.c.

783 {
784 StkId t;
785 const TValue *slot;
786 lua_lock(L);
787 api_checknelems(L, 1);
788 t = index2addr(L, idx);
789 if (luaV_fastset(L, t, n, slot, luaH_getint, L->top - 1))
790 L->top--; /* pop value */
791 else {
792 setivalue(L->top, n);
793 api_incr_top(L);
794 luaV_finishset(L, t, L->top - 1, L->top - 2, slot);
795 L->top -= 2; /* pop value and key */
796 }
797 lua_unlock(L);
798}
void luaV_finishset(lua_State *L, const TValue *t, TValue *key, StkId val, const TValue *slot)
#define luaV_fastset(L, t, k, slot, f, v)

References api_checknelems, api_incr_top, index2addr(), index2value(), lua_lock, lua_unlock, luaH_getint(), luaV_fastgeti, luaV_fastset, luaV_finishfastset, luaV_finishset(), s2v, setivalue, and lua_State::top.

Referenced by pack(), set2(), set2(), tinsert(), tinsert(), tmove(), tmove(), tpack(), tremove(), and tremove().

◆ lua_setiuservalue()

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

Definition at line 967 of file lua-5.4.3/src/lapi.c.

967 {
968 TValue *o;
969 int res;
970 lua_lock(L);
971 api_checknelems(L, 1);
972 o = index2value(L, idx);
973 api_check(L, ttisfulluserdata(o), "full userdata expected");
974 if (!(cast_uint(n) - 1u < cast_uint(uvalue(o)->nuvalue)))
975 res = 0; /* 'n' not in [1, uvalue(o)->nuvalue] */
976 else {
977 setobj(L, &uvalue(o)->uv[n - 1].uv, s2v(L->top - 1));
978 luaC_barrierback(L, gcvalue(o), s2v(L->top - 1));
979 res = 1;
980 }
981 L->top--;
982 lua_unlock(L);
983 return res;
984}
#define cast_uint(i)

References api_check, api_checknelems, cast_uint, gcvalue, index2value(), lua_lock, lua_unlock, luaC_barrierback, s2v, setobj, lua_State::top, ttisfulluserdata, and uvalue.

Referenced by db_setuservalue().

◆ lua_setlocal()

LUA_API const char * lua_setlocal ( lua_State * L,
const lua_Debug * ar,
int n )

Definition at line 138 of file lua-5.1.5/src/ldebug.c.

138 {
139 CallInfo *ci = L->base_ci + ar->i_ci;
140 const char *name = findlocal(L, ci, n);
141 lua_lock(L);
142 if (name)
143 setobjs2s(L, ci->base + (n - 1), L->top - 1);
144 L->top--; /* pop value */
145 lua_unlock(L);
146 return name;
147}

References CallInfo::base, lua_State::base_ci, findlocal(), findlocal(), findlocal(), lua_Debug::i_ci, lua_lock, lua_unlock, luaG_findlocal(), name, NULL, setobjs2s, swapextra(), swapextra(), and lua_State::top.

Referenced by db_setlocal(), db_setlocal(), db_setlocal(), and db_setlocal().

◆ lua_setmetatable()

LUA_API int lua_setmetatable ( lua_State * L,
int objindex )

Definition at line 697 of file lua-5.1.5/src/lapi.c.

697 {
698 TValue *obj;
699 Table *mt;
700 lua_lock(L);
701 api_checknelems(L, 1);
702 obj = index2adr(L, objindex);
703 api_checkvalidindex(L, obj);
704 if (ttisnil(L->top - 1))
705 mt = NULL;
706 else {
707 api_check(L, ttistable(L->top - 1));
708 mt = hvalue(L->top - 1);
709 }
710 switch (ttype(obj)) {
711 case LUA_TTABLE: {
712 hvalue(obj)->metatable = mt;
713 if (mt)
714 luaC_objbarriert(L, hvalue(obj), mt);
715 break;
716 }
717 case LUA_TUSERDATA: {
718 uvalue(obj)->metatable = mt;
719 if (mt)
720 luaC_objbarrier(L, rawuvalue(obj), mt);
721 break;
722 }
723 default: {
724 G(L)->mt[ttype(obj)] = mt;
725 break;
726 }
727 }
728 L->top--;
729 lua_unlock(L);
730 return 1;
731}
#define luaC_objbarriert(L, t, o)
#define luaC_objbarrier(L, p, o)
#define ttisnil(o)
#define rawuvalue(o)

References api_check, api_checknelems, api_checkvalidindex, G, gcvalue, hvalue, index2addr(), index2addr(), index2adr(), index2value(), lua_lock, LUA_TTABLE, LUA_TUSERDATA, lua_unlock, luaC_checkfinalizer(), luaC_objbarrier, luaC_objbarrierback, luaC_objbarriert, NULL, rawuvalue, s2v, lua_State::top, ttisnil, ttistable, ttnov, ttype, ttypenv, and uvalue.

Referenced by base_open(), createclibstable(), createclibstable(), createmetatable(), createmetatable(), createmetatable(), createmetatable(), db_sethook(), db_sethook(), db_sethook(), db_setmetatable(), db_setmetatable(), db_setmetatable(), db_setmetatable(), dir_iter_factory(), lfs_lock_dir(), ll_register(), ll_seeall(), lsqlite_backup_init(), lsqlite_make_context(), luaB_newproxy(), luaB_setmetatable(), luaB_setmetatable(), luaB_setmetatable(), luaB_setmetatable(), luaL_setmetatable(), luaopen_lsqlite3(), luaopen_package(), make_xml_object(), newbox(), newbox(), newdb(), newfile(), and newvm().

◆ lua_settable()

LUA_API void lua_settable ( lua_State * L,
int idx )

Definition at line 645 of file lua-5.1.5/src/lapi.c.

645 {
646 StkId t;
647 lua_lock(L);
648 api_checknelems(L, 2);
649 t = index2adr(L, idx);
651 luaV_settable(L, t, L->top - 2, L->top - 1);
652 L->top -= 2; /* pop index and value */
653 lua_unlock(L);
654}

References api_checknelems, api_checkvalidindex, index2addr(), index2addr(), index2adr(), index2value(), lua_lock, lua_unlock, luaH_get(), luaV_fastget, luaV_finishfastset, luaV_finishset(), luaV_settable, s2v, and lua_State::top.

Referenced by ll_register(), and luaL_findtable().

◆ lua_settop()

LUA_API void lua_settop ( lua_State * L,
int idx )

Definition at line 164 of file lua-5.1.5/src/lapi.c.

164 {
165 lua_lock(L);
166 if (idx >= 0) {
167 api_check(L, idx <= L->stack_last - L->base);
168 while (L->top < L->base + idx)
169 setnilvalue(L->top++);
170 L->top = L->base + idx;
171 }
172 else {
173 api_check(L, -(idx+1) <= (L->top - L->base));
174 L->top += idx+1; /* `subtract' index (index is negative) */
175 }
176 lua_unlock(L);
177}

References api_check, lua_State::base, lua_State::ci, CLOSEKTOP, CallInfo::func, hastocloseCfunc, lua_assert, lua_lock, lua_unlock, luaF_close(), CallInfo::nresults, s2v, setnilvalue, lua_State::tbclist, and lua_State::top.

Referenced by _file_info_(), cleanupdb(), db_busy_callback(), db_busy_handler(), db_commit_hook(), db_commit_hook_callback(), db_create_collation(), db_debug(), db_debug(), db_debug(), db_debug(), db_do_rows(), db_exec(), db_exec_callback(), db_prepare(), db_progress_callback(), db_progress_handler(), db_register_function(), db_rollback_hook(), db_rollback_hook_callback(), db_setfenv(), db_sethook(), db_sethook(), db_sethook(), db_sethook(), db_setlocal(), db_setlocal(), db_setlocal(), db_setlocal(), db_setmetatable(), db_setmetatable(), db_setmetatable(), db_setmetatable(), db_setuservalue(), db_setuservalue(), db_setuservalue(), db_sql_finalize_function(), db_sql_normal_function(), db_trace(), db_trace_callback(), db_update_hook(), db_update_hook_callback(), doREPL(), doREPL(), dotty(), dotty(), find_on_match(), finishpcall(), gmatch(), gmatch(), gmatch(), gmatch(), io_readline(), io_readline(), io_readline(), io_readline(), lcontext_set_aggregate_context(), ll_require(), ll_require(), ll_require(), ll_require(), loadline(), loadline(), loadline(), loadline(), luaB_assert(), luaB_assert(), luaB_dofile(), luaB_dofile(), luaB_dofile(), luaB_error(), luaB_error(), luaB_error(), luaB_error(), luaB_load(), luaB_load(), luaB_load(), luaB_load(), luaB_newproxy(), luaB_next(), luaB_next(), luaB_next(), luaB_next(), luaB_rawget(), luaB_rawget(), luaB_rawget(), luaB_rawget(), luaB_rawset(), luaB_rawset(), luaB_rawset(), luaB_rawset(), luaB_setmetatable(), luaB_setmetatable(), luaB_setmetatable(), luaB_setmetatable(), luaB_tonumber(), luaB_tonumber(), luaB_xpcall(), luaL_loadfile(), luaL_loadfilex(), math_ceil(), math_ceil(), math_floor(), math_floor(), math_modf(), math_modf(), os_time(), os_time(), os_time(), os_time(), pushglobalfuncname(), pushglobalfuncname(), pushglobalfuncname(), sort(), sort(), sort(), sort(), str_dump(), str_dump(), str_dump(), str_dump(), trymt(), Xml_append(), Xml_eval(), Xml_find(), Xml_iterate(), Xml_match(), Xml_new(), Xml_registerCode(), Xml_str(), and Xml_tag().

◆ lua_setupvalue()

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

Definition at line 1071 of file lua-5.1.5/src/lapi.c.

1071 {
1072 const char *name;
1073 TValue *val;
1074 StkId fi;
1075 lua_lock(L);
1076 fi = index2adr(L, funcindex);
1077 api_checknelems(L, 1);
1078 name = aux_upvalue(fi, n, &val);
1079 if (name) {
1080 L->top--;
1081 setobj(L, val, L->top);
1082 luaC_barrier(L, clvalue(fi), L->top);
1083 }
1084 lua_unlock(L);
1085 return name;
1086}

References api_checknelems, aux_upvalue(), aux_upvalue(), aux_upvalue(), aux_upvalue(), clvalue, index2addr(), index2addr(), index2adr(), index2value(), lua_lock, lua_unlock, luaC_barrier, luaC_upvalbarrier, name, NULL, owner, s2v, setobj, and lua_State::top.

Referenced by auxupvalue(), auxupvalue(), auxupvalue(), auxupvalue(), load_aux(), load_aux(), and load_aux().

◆ lua_setwarnf()

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

Definition at line 1319 of file lua-5.4.3/src/lapi.c.

1319 {
1320 lua_lock(L);
1321 G(L)->ud_warn = ud;
1322 G(L)->warnf = f;
1323 lua_unlock(L);
1324}

References G, lua_lock, and lua_unlock.

Referenced by checkcontrol(), luaL_newstate(), and warnfcont().

◆ lua_status()

LUA_API int lua_status ( lua_State * L)

Definition at line 890 of file lua-5.1.5/src/lapi.c.

890 {
891 return L->status;
892}

References lua_State::status.

Referenced by auxresume(), auxresume(), auxstatus(), costatus(), luaB_auxwrap(), luaB_costatus(), and luaB_costatus().

◆ lua_stringtonumber()

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

Definition at line 337 of file lua-5.3.6/src/lapi.c.

337 {
338 size_t sz = luaO_str2num(s, L->top);
339 if (sz != 0)
340 api_incr_top(L);
341 return sz;
342}
size_t luaO_str2num(const char *s, TValue *o)

References api_incr_top, luaO_str2num(), s, s2v, and lua_State::top.

Referenced by luaB_tonumber(), luaB_tonumber(), read_number(), read_number(), and tonum().

◆ lua_toboolean()

◆ lua_tocfunction()

LUA_API lua_CFunction lua_tocfunction ( lua_State * L,
int idx )

Definition at line 379 of file lua-5.1.5/src/lapi.c.

379 {
380 StkId o = index2adr(L, idx);
381 return (!iscfunction(o)) ? NULL : clvalue(o)->c.f;
382}

References clCvalue, clvalue, fvalue, index2addr(), index2addr(), index2adr(), index2value(), iscfunction, NULL, ttisCclosure, and ttislcf.

Referenced by aux_close().

◆ lua_toclose()

LUA_API void lua_toclose ( lua_State * L,
int idx )

Definition at line 1262 of file lua-5.4.3/src/lapi.c.

1262 {
1263 int nresults;
1264 StkId o;
1265 lua_lock(L);
1266 o = index2stack(L, idx);
1267 nresults = L->ci->nresults;
1268 api_check(L, L->tbclist < o, "given index below or equal a marked one");
1269 luaF_newtbcupval(L, o); /* create new to-be-closed upvalue */
1270 if (!hastocloseCfunc(nresults)) /* function not marked yet? */
1271 L->ci->nresults = codeNresults(nresults); /* mark it */
1273 lua_unlock(L);
1274}
#define codeNresults(n)
void luaF_newtbcupval(lua_State *L, StkId level)

References api_check, lua_State::ci, codeNresults, hastocloseCfunc, index2stack(), lua_assert, lua_lock, lua_unlock, luaF_newtbcupval(), CallS::nresults, CallInfo::nresults, and lua_State::tbclist.

Referenced by prepbuffsize().

◆ lua_tointegerx()

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

Definition at line 349 of file lua-5.2.4/src/lapi.c.

349 {
350 TValue n;
351 const TValue *o = index2addr(L, idx);
352 if (tonumber(o, &n)) {
353 lua_Integer res;
354 lua_Number num = nvalue(o);
355 lua_number2integer(res, num);
356 if (isnum) *isnum = 1;
357 return res;
358 }
359 else {
360 if (isnum) *isnum = 0;
361 return 0;
362 }
363}
LUA_INTEGER lua_Integer
LUA_NUMBER lua_Number
#define lua_number2integer(i, d)

References index2addr(), index2addr(), index2value(), lua_number2integer, nvalue, tointeger, and tonumber.

Referenced by getfield(), getfield(), getfield(), luaL_checkinteger(), luaL_checkinteger(), luaL_len(), math_toint(), and math_toint().

◆ lua_tolstring()

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

Definition at line 343 of file lua-5.1.5/src/lapi.c.

343 {
344 StkId o = index2adr(L, idx);
345 if (!ttisstring(o)) {
346 lua_lock(L); /* `luaV_tostring' may create a new string */
347 if (!luaV_tostring(L, o)) { /* conversion failed? */
348 if (len != NULL) *len = 0;
349 lua_unlock(L);
350 return NULL;
351 }
352 luaC_checkGC(L);
353 o = index2adr(L, idx); /* previous call may reallocate the stack */
354 lua_unlock(L);
355 }
356 if (len != NULL) *len = tsvalue(o)->len;
357 return svalue(o);
358}
#define ttisstring(o)
#define svalue(o)
int luaV_tostring(lua_State *L, StkId obj)

References cvt2str, index2addr(), index2addr(), index2adr(), index2value(), lua_lock, lua_unlock, luaC_checkGC, luaO_tostring(), luaV_tostring(), NULL, svalue, tsvalue, ttisstring, and vslen.

Referenced by add_s(), add_s(), add_s(), add_s(), addliteral(), addliteral(), generic_reader(), generic_reader(), generic_reader(), generic_reader(), gmatch_aux(), gmatch_aux(), incomplete(), incomplete(), incomplete(), incomplete(), loadline(), log_access(), luaB_load(), luaB_load(), luaB_load(), luaB_print(), luaB_print(), luaB_tonumber(), luaB_tonumber(), luaL_addvalue(), luaL_checklstring(), luaL_checklstring(), luaL_tolstring(), multiline(), multiline(), and tonum().

◆ lua_tonumberx()

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

Definition at line 335 of file lua-5.2.4/src/lapi.c.

335 {
336 TValue n;
337 const TValue *o = index2addr(L, idx);
338 if (tonumber(o, &n)) {
339 if (isnum) *isnum = 1;
340 return nvalue(o);
341 }
342 else {
343 if (isnum) *isnum = 0;
344 return 0;
345 }
346}

References index2addr(), index2addr(), index2value(), nvalue, and tonumber.

Referenced by luaB_tonumber(), luaL_checknumber(), and luaL_checknumber().

◆ lua_topointer()

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

Definition at line 401 of file lua-5.1.5/src/lapi.c.

401 {
402 StkId o = index2adr(L, idx);
403 switch (ttype(o)) {
404 case LUA_TTABLE: return hvalue(o);
405 case LUA_TFUNCTION: return clvalue(o);
406 case LUA_TTHREAD: return thvalue(o);
407 case LUA_TUSERDATA:
409 return lua_touserdata(L, idx);
410 default: return NULL;
411 }
412}
LUA_API void * lua_touserdata(lua_State *L, int idx)
#define thvalue(o)
#define LUA_TLIGHTUSERDATA
#define LUA_TFUNCTION

References cast, cast_sizet, cast_voidp, clCvalue, clLvalue, clvalue, fvalue, gcvalue, getudatamem, hvalue, index2addr(), index2addr(), index2adr(), index2value(), iscollectable, LUA_TCCL, LUA_TFUNCTION, LUA_TLCF, LUA_TLCL, LUA_TLIGHTUSERDATA, lua_touserdata(), LUA_TTABLE, LUA_TTHREAD, LUA_TUSERDATA, LUA_VLCF, LUA_VLIGHTUSERDATA, LUA_VUSERDATA, NULL, pvalue, thvalue, touserdata(), ttype, ttypetag, and uvalue.

Referenced by luaB_tostring(), luaL_tolstring(), print(), and str_format().

◆ lua_tothread()

◆ lua_touserdata()

◆ lua_type()

◆ lua_typename()

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

Definition at line 248 of file lua-5.1.5/src/lapi.c.

248 {
249 UNUSED(L);
250 return (t == LUA_TNONE) ? "no value" : luaT_typenames[t];
251}
const char *const luaT_typenames[]

References api_check, LUA_NUMTAGS, LUA_NUMTYPES, LUA_TNONE, luaT_typenames, ttypename, and UNUSED.

Referenced by dbvm_bind_index(), lcontext_result(), luaB_type(), luaB_type(), tag_error(), tag_error(), tag_error(), tag_error(), and Xml_str().

◆ lua_upvalueid()

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

Definition at line 1257 of file lua-5.2.4/src/lapi.c.

1257 {
1258 StkId fi = index2addr(L, fidx);
1259 switch (ttype(fi)) {
1260 case LUA_TLCL: { /* lua closure */
1261 return *getupvalref(L, fidx, n, NULL);
1262 }
1263 case LUA_TCCL: { /* C closure */
1264 CClosure *f = clCvalue(fi);
1265 api_check(L, 1 <= n && n <= f->nupvalues, "invalid upvalue index");
1266 return &f->upvalue[n - 1];
1267 }
1268 default: {
1269 api_check(L, 0, "closure expected");
1270 return NULL;
1271 }
1272 }
1273}
static UpVal ** getupvalref(lua_State *L, int fidx, int n, LClosure **pf)
#define LUA_TLCL
#define clCvalue(o)
#define LUA_TCCL

References api_check, clCvalue, getupvalref(), getupvalref(), getupvalref(), index2addr(), index2addr(), index2value(), LUA_TCCL, LUA_TLCL, LUA_VCCL, LUA_VLCF, LUA_VLCL, NULL, ttype, ttypetag, and CClosure::upvalue.

Referenced by checkupval(), db_upvalueid(), and db_upvalueid().

◆ lua_upvaluejoin()

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

Definition at line 1276 of file lua-5.2.4/src/lapi.c.

1277 {
1278 LClosure *f1;
1279 UpVal **up1 = getupvalref(L, fidx1, n1, &f1);
1280 UpVal **up2 = getupvalref(L, fidx2, n2, NULL);
1281 *up1 = *up2;
1282 luaC_objbarrier(L, f1, *up2);
1283}

References api_check, getupvalref(), getupvalref(), getupvalref(), luaC_objbarrier, luaC_upvalbarrier, luaC_upvdeccount(), NULL, UpVal::refcount, and upisopen.

Referenced by db_upvaluejoin(), db_upvaluejoin(), and db_upvaluejoin().

◆ lua_version()

LUA_API lua_Number lua_version ( lua_State * L)

Definition at line 137 of file lua-5.2.4/src/lapi.c.

137 {
138 static const lua_Number version = LUA_VERSION_NUM;
139 if (L == NULL) return &version;
140 else return G(L)->version;
141}
#define LUA_VERSION_NUM

References G, LUA_VERSION_NUM, NULL, and UNUSED.

Referenced by f_luaopen(), f_luaopen(), luaL_checkversion_(), and luaL_checkversion_().

◆ lua_warning()

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

Definition at line 1327 of file lua-5.4.3/src/lapi.c.

1327 {
1328 lua_lock(L);
1329 luaE_warning(L, msg, tocont);
1330 lua_unlock(L);
1331}
void luaE_warning(lua_State *L, const char *msg, int tocont)

References lua_lock, lua_unlock, and luaE_warning().

Referenced by luaB_warn(), and runargs().

◆ lua_xmove()

◆ lua_yieldk()

LUA_API int lua_yieldk ( lua_State * L,
int nresults,
lua_KContext ctx,
lua_KFunction k )

Definition at line 692 of file lua-5.3.6/src/ldo.c.

693 {
694 CallInfo *ci = L->ci;
695 luai_userstateyield(L, nresults);
696 lua_lock(L);
697 api_checknelems(L, nresults);
698 if (L->nny > 0) {
699 if (L != G(L)->mainthread)
700 luaG_runerror(L, "attempt to yield across a C-call boundary");
701 else
702 luaG_runerror(L, "attempt to yield from outside a coroutine");
703 }
704 L->status = LUA_YIELD;
705 ci->extra = savestack(L, ci->func); /* save current 'func' */
706 if (isLua(ci)) { /* inside a hook? */
707 api_check(L, k == NULL, "hooks cannot continue after yielding");
708 }
709 else {
710 if ((ci->u.c.k = k) != NULL) /* is there a continuation? */
711 ci->u.c.ctx = ctx; /* save context */
712 ci->func = L->top - nresults - 1; /* protect stack below results */
714 }
715 lua_assert(ci->callstatus & CIST_HOOKED); /* must be inside a hook */
716 lua_unlock(L);
717 return 0; /* return to 'luaD_hook' */
718}
void luaG_runerror(lua_State *L, const char *fmt,...)
#define luai_userstateyield(L, n)
#define CIST_HOOKED
l_noret luaD_throw(lua_State *L, int errcode)

References api_check, api_checknelems, CallInfo::c, CallInfo::callstatus, lua_State::ci, CIST_HOOKED, CallInfo::ctx, CallInfo::extra, CallInfo::func, G, isLua, isLuacode, CallInfo::k, lua_assert, lua_lock, lua_unlock, LUA_YIELD, luaD_throw(), luaG_runerror(), luai_userstateyield, lua_State::nny, NULL, CallInfo::nyield, savestack, lua_State::status, lua_State::top, CallInfo::u, CallInfo::u2, and yieldable.

Variable Documentation

◆ lua_ident

const char lua_ident[]
extern

Definition at line 34 of file lua-5.1.5/src/lapi.c.