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

Go to the source code of this file.

Data Structures

struct  luaL_Reg
 
struct  luaL_Buffer
 
struct  luaL_Stream
 

Macros

#define LUA_GNAME   "_G"
 
#define LUA_ERRFILE   (LUA_ERRERR+1)
 
#define LUA_LOADED_TABLE   "_LOADED"
 
#define LUA_PRELOAD_TABLE   "_PRELOAD"
 
#define LUAL_NUMSIZES   (sizeof(lua_Integer)*16 + sizeof(lua_Number))
 
#define luaL_checkversion(L)    luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES)
 
#define LUA_NOREF   (-2)
 
#define LUA_REFNIL   (-1)
 
#define luaL_loadfile(L, f)   luaL_loadfilex(L,f,NULL)
 
#define luaL_newlibtable(L, l)    lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)
 
#define luaL_newlib(L, l)    (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))
 
#define luaL_argcheck(L, cond, arg, extramsg)    ((void)(luai_likely(cond) || luaL_argerror(L, (arg), (extramsg))))
 
#define luaL_argexpected(L, cond, arg, tname)    ((void)(luai_likely(cond) || luaL_typeerror(L, (arg), (tname))))
 
#define luaL_checkstring(L, n)   (luaL_checklstring(L, (n), NULL))
 
#define luaL_optstring(L, n, d)   (luaL_optlstring(L, (n), (d), NULL))
 
#define luaL_typename(L, i)   lua_typename(L, lua_type(L,(i)))
 
#define luaL_dofile(L, fn)    (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
 
#define luaL_dostring(L, s)    (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
 
#define luaL_getmetatable(L, n)   (lua_getfield(L, LUA_REGISTRYINDEX, (n)))
 
#define luaL_opt(L, f, n, d)   (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
 
#define luaL_loadbuffer(L, s, sz, n)   luaL_loadbufferx(L,s,sz,n,NULL)
 
#define luaL_pushfail(L)   lua_pushnil(L)
 
#define lua_assert(c)   ((void)0)
 
#define luaL_bufflen(bf)   ((bf)->n)
 
#define luaL_buffaddr(bf)   ((bf)->b)
 
#define luaL_addchar(B, c)
 
#define luaL_addsize(B, s)   ((B)->n += (s))
 
#define luaL_buffsub(B, s)   ((B)->n -= (s))
 
#define luaL_prepbuffer(B)   luaL_prepbuffsize(B, LUAL_BUFFERSIZE)
 
#define LUA_FILEHANDLE   "FILE*"
 
#define lua_writestring(s, l)   fwrite((s), sizeof(char), (l), stdout)
 
#define lua_writeline()   (lua_writestring("\n", 1), fflush(stdout))
 
#define lua_writestringerror(s, p)    (fprintf(stderr, (s), (p)), fflush(stderr))
 

Typedefs

typedef struct luaL_Buffer luaL_Buffer
 
typedef struct luaL_Reg luaL_Reg
 
typedef struct luaL_Stream luaL_Stream
 

Functions

LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver, size_t sz)
 
LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *e)
 
LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *e)
 
LUALIB_API const char * luaL_tolstring (lua_State *L, int idx, size_t *len)
 
LUALIB_API int luaL_argerror (lua_State *L, int arg, const char *extramsg)
 
LUALIB_API int luaL_typeerror (lua_State *L, int arg, const char *tname)
 
LUALIB_API const char * luaL_checklstring (lua_State *L, int arg, size_t *l)
 
LUALIB_API const char * luaL_optlstring (lua_State *L, int arg, const char *def, size_t *l)
 
LUALIB_API lua_Number luaL_checknumber (lua_State *L, int arg)
 
LUALIB_API lua_Number luaL_optnumber (lua_State *L, int arg, lua_Number def)
 
LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int arg)
 
LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int arg, lua_Integer def)
 
LUALIB_API void luaL_checkstack (lua_State *L, int sz, const char *msg)
 
LUALIB_API void luaL_checktype (lua_State *L, int arg, int t)
 
LUALIB_API void luaL_checkany (lua_State *L, int arg)
 
LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname)
 
LUALIB_API void luaL_setmetatable (lua_State *L, const char *tname)
 
LUALIB_API void * luaL_testudata (lua_State *L, int ud, const char *tname)
 
LUALIB_API void * luaL_checkudata (lua_State *L, int ud, const char *tname)
 
LUALIB_API void luaL_where (lua_State *L, int lvl)
 
LUALIB_API int luaL_error (lua_State *L, const char *fmt,...)
 
LUALIB_API int luaL_checkoption (lua_State *L, int arg, const char *def, const char *const lst[])
 
LUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fname)
 
LUALIB_API int luaL_execresult (lua_State *L, int stat)
 
LUALIB_API int luaL_ref (lua_State *L, int t)
 
LUALIB_API void luaL_unref (lua_State *L, int t, int ref)
 
LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename, const char *mode)
 
LUALIB_API int luaL_loadbufferx (lua_State *L, const char *buff, size_t sz, const char *name, const char *mode)
 
LUALIB_API int luaL_loadstring (lua_State *L, const char *s)
 
LUALIB_API lua_StateluaL_newstate (void)
 
LUALIB_API lua_Integer luaL_len (lua_State *L, int idx)
 
LUALIB_API void luaL_addgsub (luaL_Buffer *b, const char *s, const char *p, const char *r)
 
LUALIB_API const char * luaL_gsub (lua_State *L, const char *s, const char *p, const char *r)
 
LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup)
 
LUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fname)
 
LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, const char *msg, int level)
 
LUALIB_API void luaL_requiref (lua_State *L, const char *modname, lua_CFunction openf, int glb)
 
LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B)
 
LUALIB_API char * luaL_prepbuffsize (luaL_Buffer *B, size_t sz)
 
LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l)
 
LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s)
 
LUALIB_API void luaL_addvalue (luaL_Buffer *B)
 
LUALIB_API void luaL_pushresult (luaL_Buffer *B)
 
LUALIB_API void luaL_pushresultsize (luaL_Buffer *B, size_t sz)
 
LUALIB_API char * luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz)
 

Macro Definition Documentation

◆ lua_assert

#define lua_assert ( c)    ((void)0)

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

◆ LUA_ERRFILE

#define LUA_ERRFILE   (LUA_ERRERR+1)

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

◆ LUA_FILEHANDLE

#define LUA_FILEHANDLE   "FILE*"

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

◆ LUA_GNAME

#define LUA_GNAME   "_G"

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

Referenced by luaopen_base(), and pushglobalfuncname().

◆ LUA_LOADED_TABLE

#define LUA_LOADED_TABLE   "_LOADED"

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

◆ LUA_NOREF

#define LUA_NOREF   (-2)

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

◆ LUA_PRELOAD_TABLE

#define LUA_PRELOAD_TABLE   "_PRELOAD"

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

◆ LUA_REFNIL

#define LUA_REFNIL   (-1)

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

◆ lua_writeline

#define lua_writeline ( )    (lua_writestring("\n", 1), fflush(stdout))

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

◆ lua_writestring

#define lua_writestring ( s,
l )   fwrite((s), sizeof(char), (l), stdout)

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

◆ lua_writestringerror

#define lua_writestringerror ( s,
p )    (fprintf(stderr, (s), (p)), fflush(stderr))

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

262#define lua_writestringerror(s,p) \
263 (fprintf(stderr, (s), (p)), fflush(stderr))

◆ luaL_addchar

#define luaL_addchar ( B,
c )
Value:
((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \
((B)->b[(B)->n++] = (c)))
LUALIB_API char * luaL_prepbuffsize(luaL_Buffer *B, size_t sz)

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

199#define luaL_addchar(B,c) \
200 ((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \
201 ((B)->b[(B)->n++] = (c)))

◆ luaL_addsize

#define luaL_addsize ( B,
s )   ((B)->n += (s))

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

◆ luaL_argcheck

#define luaL_argcheck ( L,
cond,
arg,
extramsg )    ((void)(luai_likely(cond) || luaL_argerror(L, (arg), (extramsg))))

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

133#define luaL_argcheck(L, cond,arg,extramsg) \
134 ((void)(luai_likely(cond) || luaL_argerror(L, (arg), (extramsg))))

◆ luaL_argexpected

#define luaL_argexpected ( L,
cond,
arg,
tname )    ((void)(luai_likely(cond) || luaL_typeerror(L, (arg), (tname))))

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

136#define luaL_argexpected(L,cond,arg,tname) \
137 ((void)(luai_likely(cond) || luaL_typeerror(L, (arg), (tname))))

Referenced by db_setmetatable(), getco(), luaB_rawlen(), luaB_setmetatable(), luaL_checkudata(), and str_gsub().

◆ luaL_buffaddr

#define luaL_buffaddr ( bf)    ((bf)->b)

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

Referenced by searchpath().

◆ luaL_bufflen

#define luaL_bufflen ( bf)    ((bf)->n)

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

Referenced by searchpath().

◆ luaL_buffsub

#define luaL_buffsub ( B,
s )   ((B)->n -= (s))

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

Referenced by findloader().

◆ luaL_checkstring

#define luaL_checkstring ( L,
n )   (luaL_checklstring(L, (n), NULL))

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

◆ luaL_checkversion

#define luaL_checkversion ( L)     luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES)

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

47#define luaL_checkversion(L) \
48 luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES)

◆ luaL_dofile

#define luaL_dofile ( L,
fn )    (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))

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

144#define luaL_dofile(L, fn) \
145 (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))

◆ luaL_dostring

#define luaL_dostring ( L,
s )    (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))

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

147#define luaL_dostring(L, s) \
148 (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))

◆ luaL_getmetatable

#define luaL_getmetatable ( L,
n )   (lua_getfield(L, LUA_REGISTRYINDEX, (n)))

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

◆ luaL_loadbuffer

#define luaL_loadbuffer ( L,
s,
sz,
n )   luaL_loadbufferx(L,s,sz,n,NULL)

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

◆ luaL_loadfile

#define luaL_loadfile ( L,
f )   luaL_loadfilex(L,f,NULL)

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

◆ luaL_newlib

#define luaL_newlib ( L,
l )    (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))

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

130#define luaL_newlib(L,l) \
131 (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))

◆ luaL_newlibtable

#define luaL_newlibtable ( L,
l )    lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)

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

127#define luaL_newlibtable(L,l) \
128 lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)

◆ LUAL_NUMSIZES

#define LUAL_NUMSIZES   (sizeof(lua_Integer)*16 + sizeof(lua_Number))

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

◆ luaL_opt

#define luaL_opt ( L,
f,
n,
d )   (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))

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

◆ luaL_optstring

#define luaL_optstring ( L,
n,
d )   (luaL_optlstring(L, (n), (d), NULL))

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

◆ luaL_prepbuffer

#define luaL_prepbuffer ( B)    luaL_prepbuffsize(B, LUAL_BUFFERSIZE)

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

◆ luaL_pushfail

◆ luaL_typename

#define luaL_typename ( L,
i )   lua_typename(L, lua_type(L,(i)))

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

Typedef Documentation

◆ luaL_Buffer

typedef struct luaL_Buffer luaL_Buffer

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

◆ luaL_Reg

typedef struct luaL_Reg luaL_Reg

◆ luaL_Stream

typedef struct luaL_Stream luaL_Stream

Function Documentation

◆ luaL_addgsub()

LUALIB_API void luaL_addgsub ( luaL_Buffer * b,
const char * s,
const char * p,
const char * r )

Definition at line 987 of file lua-5.4.3/src/lauxlib.c.

988 {
989 const char *wild;
990 size_t l = strlen(p);
991 while ((wild = strstr(s, p)) != NULL) {
992 luaL_addlstring(b, s, wild - s); /* push prefix */
993 luaL_addstring(b, r); /* push replacement in place of pattern */
994 s = wild + l; /* continue after 'p' */
995 }
996 luaL_addstring(b, s); /* push last suffix */
997}
#define NULL
Definition gmacros.h:924
LUALIB_API void luaL_addlstring(luaL_Buffer *B, const char *s, size_t l)
LUALIB_API void luaL_addstring(luaL_Buffer *B, const char *s)
CURL_EXTERN CURLMcode curl_socket_t s
Definition multi.h:318

References luaL_addlstring(), luaL_addstring(), NULL, and s.

Referenced by luaL_gsub(), pusherrornotfound(), and searchpath().

◆ luaL_addlstring()

◆ luaL_addstring()

LUALIB_API void luaL_addstring ( luaL_Buffer * B,
const char * s )

Definition at line 442 of file lua-5.1.5/src/lauxlib.c.

442 {
443 luaL_addlstring(B, s, strlen(s));
444}
LUALIB_API void luaL_addlstring(luaL_Buffer *B, const char *s, size_t l)

References luaL_addlstring(), and s.

Referenced by addquoted(), addquoted(), addquoted(), findloader(), luaL_addgsub(), luaL_gsub(), luaL_traceback(), pusherrornotfound(), setpath(), and Xml_str().

◆ luaL_addvalue()

LUALIB_API void luaL_addvalue ( luaL_Buffer * B)

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

454 {
455 lua_State *L = B->L;
456 size_t vl;
457 const char *s = lua_tolstring(L, -1, &vl);
458 if (vl <= bufffree(B)) { /* fit into buffer? */
459 memcpy(B->p, s, vl); /* put it there */
460 B->p += vl;
461 lua_pop(L, 1); /* remove from stack */
462 }
463 else {
464 if (emptybuffer(B))
465 lua_insert(L, -2); /* put buffer before new value */
466 B->lvl++; /* add new value into B stack */
467 adjuststack(B);
468 }
469}
LUA_API const char * lua_tolstring(lua_State *L, int idx, size_t *len)
static int emptybuffer(luaL_Buffer *B)
static void adjuststack(luaL_Buffer *B)
#define bufffree(B)
#define lua_pop(L, n)
#define lua_insert(L, idx)

References adjuststack(), bufffree, buffonstack, emptybuffer(), luaL_Buffer::L, lua_insert, lua_pop, lua_remove, lua_tolstring(), luaL_addlstring(), luaL_addsize, luaL_Buffer::lvl, luaL_Buffer::p, prepbuffsize(), and s.

Referenced by add_s(), add_s(), add_s(), add_s(), add_value(), add_value(), add_value(), add_value(), addfield(), addfield(), addfield(), addfield(), addliteral(), addliteral(), findloader(), findloader(), findloader(), luaL_traceback(), searchpath(), searchpath(), str_format(), str_format(), str_format(), str_format(), utfchar(), utfchar(), and Xml_str().

◆ luaL_argerror()

LUALIB_API int luaL_argerror ( lua_State * L,
int arg,
const char * extramsg )

Definition at line 43 of file lua-5.1.5/src/lauxlib.c.

43 {
44 lua_Debug ar;
45 if (!lua_getstack(L, 0, &ar)) /* no stack frame? */
46 return luaL_error(L, "bad argument #%d (%s)", narg, extramsg);
47 lua_getinfo(L, "n", &ar);
48 if (strcmp(ar.namewhat, "method") == 0) {
49 narg--; /* do not count `self' */
50 if (narg == 0) /* error is in the self argument itself? */
51 return luaL_error(L, "calling " LUA_QS " on bad self (%s)",
52 ar.name, extramsg);
53 }
54 if (ar.name == NULL)
55 ar.name = "?";
56 return luaL_error(L, "bad argument #%d to " LUA_QS " (%s)",
57 narg, ar.name, extramsg);
58}
LUALIB_API int luaL_error(lua_State *L, const char *fmt,...)
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)
#define LUA_QS
const char * name
const char * namewhat

References arg, lua_getinfo(), lua_getstack(), LUA_QS, lua_tostring, luaL_error(), lua_Debug::name, lua_Debug::namewhat, NULL, pushglobalfuncname(), pushglobalfuncname(), and pushglobalfuncname().

Referenced by addliteral(), addliteral(), b_size(), checkoption(), checkoption(), checkoption(), controloptions(), db_getinfo(), db_getinfo(), db_getinfo(), db_getinfo(), db_getlocal(), db_getlocal(), db_getlocal(), db_getlocal(), db_setlocal(), db_setlocal(), db_setlocal(), db_setlocal(), db_setuservalue(), fileerror(), g_read(), g_read(), g_read(), g_read(), getdetails(), getdetails(), getfunc(), interror(), interror(), lsqlite_checkbu(), lsqlite_checkcontext(), lsqlite_checkdb(), lsqlite_checkvm(), lsqlite_getvm(), lsqlite_open_ptr(), luaL_checkany(), luaL_checkany(), luaL_checkoption(), luaL_checkoption(), luaL_typeerror(), luaL_typerror(), str_format(), str_format(), str_format(), str_format(), str_packsize(), str_unpack(), typeerror(), and typeerror().

◆ luaL_buffinit()

◆ luaL_buffinitsize()

LUALIB_API char * luaL_buffinitsize ( lua_State * L,
luaL_Buffer * B,
size_t sz )

Definition at line 504 of file lua-5.2.4/src/lauxlib.c.

504 {
505 luaL_buffinit(L, B);
506 return luaL_prepbuffsize(B, sz);
507}
LUALIB_API char * luaL_prepbuffsize(luaL_Buffer *B, size_t sz)
LUALIB_API void luaL_buffinit(lua_State *L, luaL_Buffer *B)

References luaL_buffinit(), luaL_prepbuffsize(), and prepbuffsize().

Referenced by str_char(), str_char(), str_char(), str_lower(), str_lower(), str_lower(), str_rep(), str_rep(), str_rep(), str_reverse(), str_reverse(), str_reverse(), str_upper(), str_upper(), and str_upper().

◆ luaL_callmeta()

LUALIB_API int luaL_callmeta ( lua_State * L,
int obj,
const char * e )

Definition at line 219 of file lua-5.1.5/src/lauxlib.c.

219 {
220 obj = abs_index(L, obj);
221 if (!luaL_getmetafield(L, obj, event)) /* no metafield? */
222 return 0;
223 lua_pushvalue(L, obj);
224 lua_call(L, 1, 1);
225 return 1;
226}
LUA_API void lua_pushvalue(lua_State *L, int idx)
#define abs_index(L, i)
LUALIB_API int luaL_getmetafield(lua_State *L, int obj, const char *event)
#define lua_call(L, n, r)

References abs_index, lua_absindex(), lua_call, lua_pushvalue(), LUA_TNIL, and luaL_getmetafield().

Referenced by luaB_tostring(), luaL_tolstring(), msghandler(), msghandler(), and traceback().

◆ luaL_checkany()

LUALIB_API void luaL_checkany ( lua_State * L,
int arg )

◆ luaL_checkinteger()

LUALIB_API lua_Integer luaL_checkinteger ( lua_State * L,
int arg )

◆ luaL_checklstring()

◆ luaL_checknumber()

LUALIB_API lua_Number luaL_checknumber ( lua_State * L,
int arg )

Definition at line 176 of file lua-5.1.5/src/lauxlib.c.

176 {
177 lua_Number d = lua_tonumber(L, narg);
178 if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */
179 tag_error(L, narg, LUA_TNUMBER);
180 return d;
181}
LUA_NUMBER lua_Number
#define lua_tonumber(L, i)

References arg, lua_isnumber(), LUA_TNUMBER, lua_tonumber, lua_tonumberx(), tag_error(), tag_error(), tag_error(), and tag_error().

Referenced by b_pack(), dbvm_bind_parameter_name(), dbvm_get_name(), dbvm_get_type(), lcontext_result(), lcontext_result_double(), luaL_optnumber(), luaL_optnumber(), 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_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_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_randomseed(), 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(), os_date(), os_date(), os_difftime(), os_difftime(), putinteger(), str_format(), str_format(), str_format(), str_format(), str_pack(), and str_pack().

◆ luaL_checkoption()

LUALIB_API int luaL_checkoption ( lua_State * L,
int arg,
const char * def,
const char *const lst[] )

Definition at line 99 of file lua-5.1.5/src/lauxlib.c.

100 {
101 const char *name = (def) ? luaL_optstring(L, narg, def) :
102 luaL_checkstring(L, narg);
103 int i;
104 for (i=0; lst[i]; i++)
105 if (strcmp(lst[i], name) == 0)
106 return i;
107 return luaL_argerror(L, narg,
108 lua_pushfstring(L, "invalid option " LUA_QS, name));
109}
const char * name
Definition lsqlite3.c:2154
LUA_API const char * lua_pushfstring(lua_State *L, const char *fmt,...)
#define luaL_optstring(L, n, d)
#define luaL_checkstring(L, n)

References arg, lua_pushfstring(), LUA_QS, luaL_argerror(), luaL_argerror(), luaL_checkstring, luaL_optstring, and name.

Referenced by f_seek(), f_seek(), f_seek(), f_seek(), f_setvbuf(), f_setvbuf(), f_setvbuf(), f_setvbuf(), lfs_g_setmode(), luaB_collectgarbage(), luaB_collectgarbage(), luaB_collectgarbage(), luaB_collectgarbage(), os_setlocale(), os_setlocale(), os_setlocale(), and os_setlocale().

◆ luaL_checkstack()

◆ luaL_checktype()

◆ luaL_checkudata()

LUALIB_API void * luaL_checkudata ( lua_State * L,
int ud,
const char * tname )

Definition at line 124 of file lua-5.1.5/src/lauxlib.c.

124 {
125 void *p = lua_touserdata(L, ud);
126 if (p != NULL) { /* value is a userdata? */
127 if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
128 lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */
129 if (lua_rawequal(L, -1, -2)) { /* does it have the correct mt? */
130 lua_pop(L, 2); /* remove both metatables */
131 return p;
132 }
133 }
134 }
135 luaL_typerror(L, ud, tname); /* else error */
136 return NULL; /* to avoid warnings */
137}
LUA_API int lua_getmetatable(lua_State *L, int objindex)
LUA_API void * lua_touserdata(lua_State *L, int idx)
LUA_API int lua_rawequal(lua_State *L, int index1, int index2)
LUA_API void lua_getfield(lua_State *L, int idx, const char *k)
LUALIB_API int luaL_typerror(lua_State *L, int narg, const char *tname)
#define LUA_REGISTRYINDEX

References lua_getfield(), lua_getmetatable(), lua_pop, lua_rawequal(), LUA_REGISTRYINDEX, lua_touserdata(), luaL_argexpected, luaL_testudata(), luaL_typerror(), NULL, typeerror(), and typeerror().

Referenced by check_file(), dir_iter(), gctm(), lfs_unlock_dir(), lsqlite_getbu(), lsqlite_getcontext(), lsqlite_getdb(), and lsqlite_getvm().

◆ luaL_checkversion_()

LUALIB_API void luaL_checkversion_ ( lua_State * L,
lua_Number ver,
size_t sz )

Definition at line 1038 of file lua-5.3.6/src/lauxlib.c.

1038 {
1039 const lua_Number *v = lua_version(L);
1040 if (sz != LUAL_NUMSIZES) /* check numeric types */
1041 luaL_error(L, "core and library have incompatible numeric types");
1042 if (v != lua_version(NULL))
1043 luaL_error(L, "multiple Lua VMs detected");
1044 else if (*v != ver)
1045 luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f",
1046 (LUAI_UACNUMBER)ver, (LUAI_UACNUMBER)*v);
1047}
#define LUAI_UACNUMBER
LUA_API const lua_Number * lua_version(lua_State *L)
LUALIB_API int luaL_error(lua_State *L, const char *fmt,...)
#define LUAL_NUMSIZES

References lua_version(), LUAI_UACNUMBER, luaL_error(), LUAL_NUMSIZES, and NULL.

◆ luaL_error()

LUALIB_API int luaL_error ( lua_State * L,
const char * fmt,
... )

Definition at line 86 of file lua-5.1.5/src/lauxlib.c.

86 {
87 va_list argp;
88 va_start(argp, fmt);
89 luaL_where(L, 1);
90 lua_pushvfstring(L, fmt, argp);
91 va_end(argp);
92 lua_concat(L, 2);
93 return lua_error(L);
94}
LUA_API void lua_concat(lua_State *L, int n)
LUA_API int lua_error(lua_State *L)
LUA_API const char * lua_pushvfstring(lua_State *L, const char *fmt, va_list argp)
LUALIB_API void luaL_where(lua_State *L, int level)

References lua_concat(), lua_error(), lua_pushvfstring(), and luaL_where().

Referenced by _file_info_(), _file_lock(), add_s(), add_s(), add_s(), add_value(), add_value(), add_value(), add_value(), addfield(), addfield(), addfield(), addfield(), auxresume(), auxsort(), auxsort(), b_unpack(), byteoffset(), byteoffset(), capture_to_close(), capture_to_close(), capture_to_close(), capture_to_close(), check_capture(), check_capture(), check_capture(), check_capture(), check_file(), checkload(), checkload(), checkload(), checkstack(), checkstack(), checkstack(), classend(), classend(), classend(), classend(), codepoint(), codepoint(), controloptions(), db_create_collation(), db_register_function(), db_setfenv(), dbvm_bind_index(), dbvm_bind_values(), dbvm_check_bind_index(), dbvm_check_contents(), dbvm_check_index(), dir_iter_factory(), fieldargs(), findfile(), findfile(), findfile(), findfile(), findloader(), findloader(), findloader(), generic_reader(), generic_reader(), generic_reader(), generic_reader(), get_onecapture(), getfield(), getfield(), getfield(), getfield(), getfunc(), getiofile(), getiofile(), getiofile(), getiofile(), getnumlimit(), getnumlimit(), getoption(), getoption(), gfind_nodef(), io_readline(), io_readline(), io_readline(), io_readline(), iter_aux(), iter_aux(), lcontext_check_aggregate(), lcontext_result(), ll_module(), ll_require(), loader_preload(), loaderror(), lstop(), lstop(), lstop(), lstop(), luaB_assert(), luaB_assert(), luaB_close(), luaB_print(), luaB_print(), luaB_print(), luaB_setfenv(), luaB_setmetatable(), luaB_setmetatable(), luaB_setmetatable(), luaB_setmetatable(), luaB_unpack(), luaI_openlib(), luaL_argerror(), luaL_argerror(), luaL_checkstack(), luaL_checkstack(), luaL_checkversion_(), luaL_checkversion_(), luaL_len(), luaL_prepbuffsize(), luaL_tolstring(), luaopen_bit32(), make_xml_object(), match(), match(), match(), match(), matchbalance(), matchbalance(), matchbalance(), matchbalance(), math_random(), math_random(), math_random(), math_random(), newbuffsize(), opencheck(), opencheck(), opencheck(), optsize(), os_date(), os_date(), os_time(), os_time(), os_tmpname(), os_tmpname(), os_tmpname(), os_tmpname(), partition(), partition(), push_onecapture(), push_onecapture(), push_onecapture(), pushargs(), pushargs(), resizebox(), scanformat(), scanformat(), scanformat(), scanformat(), setfenv(), setfield(), setn(), start_capture(), start_capture(), start_capture(), start_capture(), str_byte(), str_byte(), str_byte(), str_byte(), str_dump(), str_dump(), str_dump(), str_dump(), str_format(), str_format(), str_format(), str_format(), str_rep(), str_rep(), str_rep(), tinsert(), tinsert(), tinsert(), tinsert(), tofile(), tofile(), tofile(), tofile(), trymt(), tunpack(), unpack(), unpack(), unpackint(), unpackint(), Xml_eval(), and Xml_load().

◆ luaL_execresult()

LUALIB_API int luaL_execresult ( lua_State * L,
int stat )

Definition at line 247 of file lua-5.2.4/src/lauxlib.c.

247 {
248 const char *what = "exit"; /* type of termination */
249 if (stat == -1) /* error? */
250 return luaL_fileresult(L, 0, NULL);
251 else {
252 inspectstat(stat, what); /* interpret result */
253 if (*what == 'e' && stat == 0) /* successful termination? */
254 lua_pushboolean(L, 1);
255 else
256 lua_pushnil(L);
257 lua_pushstring(L, what);
258 lua_pushinteger(L, stat);
259 return 3; /* return true/nil,what,code */
260 }
261}
LUA_API void lua_pushstring(lua_State *L, const char *s)
LUA_API void lua_pushnil(lua_State *L)
LUA_API void lua_pushboolean(lua_State *L, int b)
LUA_API void lua_pushinteger(lua_State *L, lua_Integer n)
LUALIB_API int luaL_fileresult(lua_State *L, int stat, const char *fname)
#define inspectstat(stat, what)

References inspectstat, l_inspectstat, lua_pushboolean(), lua_pushinteger(), lua_pushnil(), lua_pushstring(), luaL_fileresult(), luaL_pushfail, and NULL.

Referenced by io_pclose(), io_pclose(), io_pclose(), os_execute(), os_execute(), and os_execute().

◆ luaL_fileresult()

LUALIB_API int luaL_fileresult ( lua_State * L,
int stat,
const char * fname )

Definition at line 207 of file lua-5.2.4/src/lauxlib.c.

207 {
208 int en = errno; /* calls to Lua API may change this value */
209 if (stat) {
210 lua_pushboolean(L, 1);
211 return 1;
212 }
213 else {
214 lua_pushnil(L);
215 if (fname)
216 lua_pushfstring(L, "%s: %s", fname, strerror(en));
217 else
218 lua_pushstring(L, strerror(en));
219 lua_pushinteger(L, en);
220 return 3;
221 }
222}

References lua_pushboolean(), lua_pushfstring(), lua_pushinteger(), lua_pushnil(), lua_pushstring(), and luaL_pushfail.

Referenced by f_flush(), f_flush(), f_flush(), f_seek(), f_seek(), f_seek(), f_setvbuf(), f_setvbuf(), f_setvbuf(), g_read(), g_read(), g_read(), g_write(), g_write(), g_write(), io_fclose(), io_fclose(), io_fclose(), io_flush(), io_flush(), io_flush(), io_open(), io_open(), io_open(), io_popen(), io_popen(), io_popen(), io_tmpfile(), io_tmpfile(), io_tmpfile(), luaL_execresult(), os_remove(), os_remove(), os_remove(), os_rename(), os_rename(), and os_rename().

◆ luaL_getmetafield()

LUALIB_API int luaL_getmetafield ( lua_State * L,
int obj,
const char * e )

Definition at line 203 of file lua-5.1.5/src/lauxlib.c.

203 {
204 if (!lua_getmetatable(L, obj)) /* no metatable? */
205 return 0;
206 lua_pushstring(L, event);
207 lua_rawget(L, -2);
208 if (lua_isnil(L, -1)) {
209 lua_pop(L, 2); /* remove metatable and metafield */
210 return 0;
211 }
212 else {
213 lua_remove(L, -2); /* remove only metatable */
214 return 1;
215 }
216}
LUA_API void lua_rawget(lua_State *L, int idx)
#define lua_isnil(L, n)
#define lua_remove(L, idx)

References lua_getmetatable(), lua_isnil, lua_pop, lua_pushstring(), lua_rawget(), lua_remove, and LUA_TNIL.

Referenced by luaB_getmetatable(), luaB_getmetatable(), luaB_getmetatable(), luaB_getmetatable(), luaB_pairs(), luaB_setmetatable(), luaB_setmetatable(), luaB_setmetatable(), luaB_setmetatable(), luaL_callmeta(), luaL_tolstring(), luaL_typeerror(), pairsmeta(), pairsmeta(), trymt(), and typeerror().

◆ luaL_getsubtable()

LUALIB_API int luaL_getsubtable ( lua_State * L,
int idx,
const char * fname )

Definition at line 866 of file lua-5.2.4/src/lauxlib.c.

866 {
867 lua_getfield(L, idx, fname);
868 if (lua_istable(L, -1)) return 1; /* table already there */
869 else {
870 lua_pop(L, 1); /* remove previous result */
871 idx = lua_absindex(L, idx);
872 lua_newtable(L);
873 lua_pushvalue(L, -1); /* copy to be left at top */
874 lua_setfield(L, idx, fname); /* assign new table to field */
875 return 0; /* false, because did not find table there */
876 }
877}
LUA_API void lua_setfield(lua_State *L, int idx, const char *k)
#define lua_istable(L, n)
#define lua_newtable(L)
LUA_API int lua_absindex(lua_State *L, int idx)

References lua_absindex(), lua_getfield(), lua_istable, lua_newtable, lua_pop, lua_pushvalue(), lua_setfield(), and LUA_TTABLE.

Referenced by createclibstable(), db_sethook(), luaL_openlibs(), luaL_requiref(), and luaopen_package().

◆ luaL_gsub()

LUALIB_API const char * luaL_gsub ( lua_State * L,
const char * s,
const char * p,
const char * r )

Definition at line 340 of file lua-5.1.5/src/lauxlib.c.

341 {
342 const char *wild;
343 size_t l = strlen(p);
344 luaL_Buffer b;
345 luaL_buffinit(L, &b);
346 while ((wild = strstr(s, p)) != NULL) {
347 luaL_addlstring(&b, s, wild - s); /* push prefix */
348 luaL_addstring(&b, r); /* push replacement in place of pattern */
349 s = wild + l; /* continue after `p' */
350 }
351 luaL_addstring(&b, s); /* push last suffix */
352 luaL_pushresult(&b);
353 return lua_tostring(L, -1);
354}
LUALIB_API void luaL_buffinit(lua_State *L, luaL_Buffer *B)
LUALIB_API void luaL_pushresult(luaL_Buffer *B)
LUALIB_API void luaL_addstring(luaL_Buffer *B, const char *s)
#define lua_tostring(L, i)

References lua_tostring, luaL_addgsub(), luaL_addlstring(), luaL_addstring(), luaL_buffinit(), luaL_pushresult(), NULL, and s.

Referenced by do_gsub(), findfile(), loadfunc(), loadfunc(), loadfunc(), mkfuncname(), searchpath(), searchpath(), searchpath(), setpath(), setpath(), and setpath().

◆ luaL_len()

LUALIB_API lua_Integer luaL_len ( lua_State * L,
int idx )

Definition at line 725 of file lua-5.2.4/src/lauxlib.c.

725 {
726 int l;
727 int isnum;
728 lua_len(L, idx);
729 l = (int)lua_tointegerx(L, -1, &isnum);
730 if (!isnum)
731 luaL_error(L, "object length is not a number");
732 lua_pop(L, 1); /* remove object */
733 return l;
734}
LUA_API lua_Integer lua_tointegerx(lua_State *L, int idx, int *isnum)
LUA_API void lua_len(lua_State *L, int idx)
LUALIB_API int luaL_error(lua_State *L, const char *fmt,...)

References lua_len(), lua_pop, lua_tointegerx(), and luaL_error().

Referenced by addtoclib(), addtoclib(), gctm(), gctm(), gctm(), ll_addtoclib(), pushargs(), pushargs(), tconcat(), tunpack(), unpack(), and unpack().

◆ luaL_loadbufferx()

LUALIB_API int luaL_loadbufferx ( lua_State * L,
const char * buff,
size_t sz,
const char * name,
const char * mode )

Definition at line 682 of file lua-5.2.4/src/lauxlib.c.

683 {
684 LoadS ls;
685 ls.s = buff;
686 ls.size = size;
687 return lua_load(L, getS, &ls, name, mode);
688}
LUA_API int lua_load(lua_State *L, lua_Reader reader, void *data, const char *chunkname)
static const char * getS(lua_State *L, void *ud, size_t *size)
const char * s

References getS(), getS(), getS(), lua_load(), name, LoadS::s, and LoadS::size.

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

◆ luaL_loadfilex()

LUALIB_API int luaL_loadfilex ( lua_State * L,
const char * filename,
const char * mode )

Definition at line 630 of file lua-5.2.4/src/lauxlib.c.

631 {
632 LoadF lf;
633 int status, readstatus;
634 int c;
635 int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */
636 if (filename == NULL) {
637 lua_pushliteral(L, "=stdin");
638 lf.f = stdin;
639 }
640 else {
641 lua_pushfstring(L, "@%s", filename);
642 lf.f = fopen(filename, "r");
643 if (lf.f == NULL) return errfile(L, "open", fnameindex);
644 }
645 if (skipcomment(&lf, &c)) /* read initial portion */
646 lf.buff[lf.n++] = '\n'; /* add line to correct line numbers */
647 if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */
648 lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */
649 if (lf.f == NULL) return errfile(L, "reopen", fnameindex);
650 skipcomment(&lf, &c); /* re-read initial portion */
651 }
652 if (c != EOF)
653 lf.buff[lf.n++] = c; /* 'c' is the first character of the stream */
654 status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode);
655 readstatus = ferror(lf.f);
656 if (filename) fclose(lf.f); /* close file (even in case of errors) */
657 if (readstatus) {
658 lua_settop(L, fnameindex); /* ignore results from `lua_load' */
659 return errfile(L, "read", fnameindex);
660 }
661 lua_remove(L, fnameindex);
662 return status;
663}
LUA_API void lua_settop(lua_State *L, int idx)
LUA_API int lua_gettop(lua_State *L)
#define lua_pushliteral(L, s)
#define LUA_SIGNATURE
static int errfile(lua_State *L, const char *what, int fnameindex)
static int skipcomment(LoadF *lf, int *cp)
static const char * getF(lua_State *L, void *ud, size_t *size)
char buff[LUAL_BUFFERSIZE]

References LoadF::buff, errfile(), errfile(), errfile(), LoadF::f, getF(), getF(), getF(), lua_gettop(), lua_load(), lua_pushfstring(), lua_pushliteral, lua_remove, lua_settop(), LUA_SIGNATURE, lua_tostring, LoadF::n, NULL, skipcomment(), skipcomment(), and skipcomment().

Referenced by luaB_loadfile(), luaB_loadfile(), and luaB_loadfile().

◆ luaL_loadstring()

LUALIB_API int luaL_loadstring ( lua_State * L,
const char * s )

Definition at line 618 of file lua-5.1.5/src/lauxlib.c.

618 {
619 return luaL_loadbuffer(L, s, strlen(s), s);
620}
#define luaL_loadbuffer(L, s, sz, n)

References luaL_loadbuffer, and s.

◆ luaL_newmetatable()

LUALIB_API int luaL_newmetatable ( lua_State * L,
const char * tname )

Definition at line 112 of file lua-5.1.5/src/lauxlib.c.

112 {
113 lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */
114 if (!lua_isnil(L, -1)) /* name already in use? */
115 return 0; /* leave previous value on top, but return 0 */
116 lua_pop(L, 1);
117 lua_newtable(L); /* create metatable */
118 lua_pushvalue(L, -1);
119 lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */
120 return 1;
121}

References lua_createtable(), lua_getfield(), lua_isnil, lua_newtable, lua_pop, lua_pushstring(), lua_pushvalue(), LUA_REGISTRYINDEX, lua_setfield(), LUA_TNIL, and luaL_getmetatable.

Referenced by create_meta(), createmeta(), createmeta(), createmeta(), createmeta(), dir_create_meta(), lock_create_meta(), luaopen_LuaXML_lib(), luaopen_package(), newbox(), and newbox().

◆ luaL_newstate()

LUALIB_API lua_State * luaL_newstate ( void )

Definition at line 647 of file lua-5.1.5/src/lauxlib.c.

647 {
649 if (L) lua_atpanic(L, &panic);
650 return L;
651}
LUA_API lua_CFunction lua_atpanic(lua_State *L, lua_CFunction panicf)
static int panic(lua_State *L)
static void * l_alloc(void *ud, void *ptr, size_t osize, size_t nsize)
LUA_API lua_State * lua_newstate(lua_Alloc f, void *ud)

References l_alloc(), l_alloc(), l_alloc(), l_alloc(), lua_atpanic(), lua_newstate(), lua_setwarnf(), NULL, panic(), panic(), panic(), panic(), and warnfoff().

Referenced by main(), and main().

◆ luaL_optinteger()

◆ luaL_optlstring()

LUALIB_API const char * luaL_optlstring ( lua_State * L,
int arg,
const char * def,
size_t * l )

Definition at line 165 of file lua-5.1.5/src/lauxlib.c.

166 {
167 if (lua_isnoneornil(L, narg)) {
168 if (len)
169 *len = (def ? strlen(def) : 0);
170 return def;
171 }
172 else return luaL_checklstring(L, narg, len);
173}
LUALIB_API const char * luaL_checklstring(lua_State *L, int narg, size_t *len)
#define lua_isnoneornil(L, n)

References arg, lua_isnoneornil, luaL_checklstring(), and luaL_checklstring().

Referenced by os_date(), os_date(), str_rep(), str_rep(), str_rep(), tconcat(), tconcat(), tconcat(), and tconcat().

◆ luaL_optnumber()

LUALIB_API lua_Number luaL_optnumber ( lua_State * L,
int arg,
lua_Number def )

Definition at line 184 of file lua-5.1.5/src/lauxlib.c.

184 {
185 return luaL_opt(L, luaL_checknumber, narg, def);
186}
LUALIB_API lua_Number luaL_checknumber(lua_State *L, int narg)

References arg, luaL_checknumber(), luaL_checknumber(), and luaL_opt.

Referenced by f_seek(), file_utime(), math_atan(), math_atan(), os_difftime(), and os_difftime().

◆ luaL_prepbuffsize()

LUALIB_API char * luaL_prepbuffsize ( luaL_Buffer * B,
size_t sz )

Definition at line 437 of file lua-5.2.4/src/lauxlib.c.

437 {
438 lua_State *L = B->L;
439 if (B->size - B->n < sz) { /* not enough space? */
440 char *newbuff;
441 size_t newsize = B->size * 2; /* double buffer size */
442 if (newsize - B->n < sz) /* not big enough? */
443 newsize = B->n + sz;
444 if (newsize < B->n || newsize - B->n < sz)
445 luaL_error(L, "buffer too large");
446 /* create larger buffer */
447 newbuff = (char *)lua_newuserdata(L, newsize * sizeof(char));
448 /* move content to new buffer */
449 memcpy(newbuff, B->b, B->n * sizeof(char));
450 if (buffonstack(B))
451 lua_remove(L, -2); /* remove old buffer */
452 B->b = newbuff;
453 B->size = newsize;
454 }
455 return &B->b[B->n];
456}
#define buffonstack(B)
#define lua_newuserdata(L, s)

References luaL_Buffer::b, buffonstack, luaL_Buffer::L, lua_newuserdata, lua_remove, luaL_error(), luaL_Buffer::n, newbox(), prepbuffsize(), resizebox(), and luaL_Buffer::size.

Referenced by addliteral(), addliteral(), luaL_addlstring(), luaL_buffinitsize(), os_date(), os_date(), packint(), packint(), read_all(), read_chars(), read_chars(), read_chars(), str_format(), str_format(), str_format(), str_pack(), and str_pack().

◆ luaL_pushresult()

◆ luaL_pushresultsize()

LUALIB_API void luaL_pushresultsize ( luaL_Buffer * B,
size_t sz )

Definition at line 479 of file lua-5.2.4/src/lauxlib.c.

479 {
480 luaL_addsize(B, sz);
482}
#define luaL_addsize(B, n)
LUALIB_API void luaL_pushresult(luaL_Buffer *B)

References luaL_addsize, and luaL_pushresult().

Referenced by str_char(), str_char(), str_char(), str_lower(), str_lower(), str_lower(), str_rep(), str_rep(), str_rep(), str_reverse(), str_reverse(), str_reverse(), str_upper(), str_upper(), and str_upper().

◆ luaL_ref()

LUALIB_API int luaL_ref ( lua_State * L,
int t )

Definition at line 481 of file lua-5.1.5/src/lauxlib.c.

481 {
482 int ref;
483 t = abs_index(L, t);
484 if (lua_isnil(L, -1)) {
485 lua_pop(L, 1); /* remove from stack */
486 return LUA_REFNIL; /* `nil' has a unique fixed reference */
487 }
488 lua_rawgeti(L, t, FREELIST_REF); /* get first free element */
489 ref = (int)lua_tointeger(L, -1); /* ref = t[FREELIST_REF] */
490 lua_pop(L, 1); /* remove it from stack */
491 if (ref != 0) { /* any free element? */
492 lua_rawgeti(L, t, ref); /* remove it from list */
493 lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */
494 }
495 else { /* no free elements */
496 ref = (int)lua_objlen(L, t);
497 ref++; /* create new reference */
498 }
499 lua_rawseti(L, t, ref);
500 return ref;
501}
LUA_API void lua_rawseti(lua_State *L, int idx, int n)
LUA_API size_t lua_objlen(lua_State *L, int idx)
LUA_API void lua_rawgeti(lua_State *L, int idx, int n)
#define FREELIST_REF
#define LUA_REFNIL

References abs_index, freelist, FREELIST_REF, lua_absindex(), lua_assert, lua_isinteger(), lua_isnil, lua_objlen(), lua_pop, lua_pushinteger(), lua_rawgeti(), lua_rawlen, lua_rawseti(), LUA_REFNIL, LUA_TNIL, and lua_tointeger.

Referenced by db_busy_handler(), db_commit_hook(), db_create_collation(), db_progress_handler(), db_register_function(), db_rollback_hook(), db_trace(), db_update_hook(), lcontext_set_aggregate_context(), luaopen_lsqlite3(), and luaopen_LuaXML_lib().

◆ luaL_requiref()

LUALIB_API void luaL_requiref ( lua_State * L,
const char * modname,
lua_CFunction openf,
int glb )

Definition at line 886 of file lua-5.2.4/src/lauxlib.c.

887 {
888 lua_pushcfunction(L, openf);
889 lua_pushstring(L, modname); /* argument to open function */
890 lua_call(L, 1, 1); /* open module */
891 luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
892 lua_pushvalue(L, -2); /* make copy of module (call result) */
893 lua_setfield(L, -2, modname); /* _LOADED[modname] = module */
894 lua_pop(L, 1); /* remove _LOADED table */
895 if (glb) {
896 lua_pushvalue(L, -1); /* copy of 'mod' */
897 lua_setglobal(L, modname); /* _G[modname] = module */
898 }
899}
#define lua_pushcfunction(L, f)
#define lua_setglobal(L, s)
LUALIB_API int luaL_getsubtable(lua_State *L, int idx, const char *fname)

References lua_call, lua_getfield(), LUA_LOADED_TABLE, lua_pop, lua_pushcfunction, lua_pushstring(), lua_pushvalue(), LUA_REGISTRYINDEX, lua_remove, lua_setfield(), lua_setglobal, lua_toboolean(), and luaL_getsubtable().

Referenced by luaL_openlibs(), and luaopen_lsqlite3().

◆ luaL_setfuncs()

LUALIB_API void luaL_setfuncs ( lua_State * L,
const luaL_Reg * l,
int nup )

Definition at line 848 of file lua-5.2.4/src/lauxlib.c.

848 {
850 luaL_checkstack(L, nup, "too many upvalues");
851 for (; l->name != NULL; l++) { /* fill the table with given functions */
852 int i;
853 for (i = 0; i < nup; i++) /* copy upvalues to the top */
854 lua_pushvalue(L, -nup);
855 lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */
856 lua_setfield(L, -(nup + 2), l->name);
857 }
858 lua_pop(L, nup); /* remove upvalues */
859}
LUA_API void lua_pushcclosure(lua_State *L, lua_CFunction fn, int n)
LUALIB_API void luaL_checkstack(lua_State *L, int space, const char *msg)
#define luaL_checkversion(L)
lua_CFunction func
const char * name

References luaL_Reg::func, lua_pop, lua_pushboolean(), lua_pushcclosure(), lua_pushvalue(), lua_setfield(), luaL_checkstack(), luaL_checkversion, luaL_Reg::name, and NULL.

Referenced by createmeta(), createmeta(), createmeta(), createmetatable(), luaopen_base(), luaopen_package(), luaopen_sqlitelib(), newbox(), and setrandfunc().

◆ luaL_setmetatable()

LUALIB_API void luaL_setmetatable ( lua_State * L,
const char * tname )

Definition at line 284 of file lua-5.2.4/src/lauxlib.c.

284 {
285 luaL_getmetatable(L, tname);
286 lua_setmetatable(L, -2);
287}
LUA_API int lua_setmetatable(lua_State *L, int objindex)
#define luaL_getmetatable(L, n)

References lua_setmetatable(), and luaL_getmetatable.

Referenced by newprefile(), newprefile(), and newprefile().

◆ luaL_testudata()

LUALIB_API void * luaL_testudata ( lua_State * L,
int ud,
const char * tname )

Definition at line 290 of file lua-5.2.4/src/lauxlib.c.

290 {
291 void *p = lua_touserdata(L, ud);
292 if (p != NULL) { /* value is a userdata? */
293 if (lua_getmetatable(L, ud)) { /* does it have a metatable? */
294 luaL_getmetatable(L, tname); /* get correct metatable */
295 if (!lua_rawequal(L, -1, -2)) /* not the same? */
296 p = NULL; /* value is a userdata with wrong metatable */
297 lua_pop(L, 2); /* remove both metatables */
298 return p;
299 }
300 }
301 return NULL; /* value is not a userdata with a metatable */
302}

References lua_getmetatable(), lua_pop, lua_rawequal(), lua_touserdata(), luaL_getmetatable, and NULL.

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

◆ luaL_tolstring()

LUALIB_API const char * luaL_tolstring ( lua_State * L,
int idx,
size_t * len )

Definition at line 737 of file lua-5.2.4/src/lauxlib.c.

737 {
738 if (!luaL_callmeta(L, idx, "__tostring")) { /* no metafield? */
739 switch (lua_type(L, idx)) {
740 case LUA_TNUMBER:
741 case LUA_TSTRING:
742 lua_pushvalue(L, idx);
743 break;
744 case LUA_TBOOLEAN:
745 lua_pushstring(L, (lua_toboolean(L, idx) ? "true" : "false"));
746 break;
747 case LUA_TNIL:
748 lua_pushliteral(L, "nil");
749 break;
750 default:
751 lua_pushfstring(L, "%s: %p", luaL_typename(L, idx),
752 lua_topointer(L, idx));
753 break;
754 }
755 }
756 return lua_tolstring(L, -1, len);
757}
LUA_API int lua_toboolean(lua_State *L, int idx)
LUA_API const void * lua_topointer(lua_State *L, int idx)
#define luaL_typename(L, i)
#define LUA_TBOOLEAN
#define LUA_TNIL
LUALIB_API int luaL_callmeta(lua_State *L, int obj, const char *event)

References lua_isinteger(), lua_isstring(), lua_pushfstring(), lua_pushliteral, lua_pushstring(), lua_pushvalue(), lua_remove, LUA_TBOOLEAN, LUA_TNIL, LUA_TNUMBER, lua_toboolean(), lua_tointeger, lua_tolstring(), lua_tonumber, lua_topointer(), lua_tostring, LUA_TSTRING, lua_type(), LUAI_UACINT, LUAI_UACNUMBER, luaL_callmeta(), luaL_error(), luaL_getmetafield(), and luaL_typename.

Referenced by add_s(), addliteral(), addliteral(), db_debug(), get_prompt(), luaB_print(), luaB_tostring(), luaB_tostring(), luaB_tostring(), str_format(), str_format(), and str_format().

◆ luaL_traceback()

LUALIB_API void luaL_traceback ( lua_State * L,
lua_State * L1,
const char * msg,
int level )

Definition at line 116 of file lua-5.2.4/src/lauxlib.c.

117 {
118 lua_Debug ar;
119 int top = lua_gettop(L);
120 int numlevels = countlevels(L1);
121 int mark = (numlevels > LEVELS1 + LEVELS2) ? LEVELS1 : 0;
122 if (msg) lua_pushfstring(L, "%s\n", msg);
123 lua_pushliteral(L, "stack traceback:");
124 while (lua_getstack(L1, level++, &ar)) {
125 if (level == mark) { /* too many levels? */
126 lua_pushliteral(L, "\n\t..."); /* add a '...' */
127 level = numlevels - LEVELS2; /* and skip to last ones */
128 }
129 else {
130 lua_getinfo(L1, "Slnt", &ar);
131 lua_pushfstring(L, "\n\t%s:", ar.short_src);
132 if (ar.currentline > 0)
133 lua_pushfstring(L, "%d:", ar.currentline);
134 lua_pushliteral(L, " in ");
135 pushfuncname(L, &ar);
136 if (ar.istailcall)
137 lua_pushliteral(L, "\n\t(...tail calls...)");
138 lua_concat(L, lua_gettop(L) - top);
139 }
140 }
141 lua_concat(L, lua_gettop(L) - top);
142}
static void pushfuncname(lua_State *L, lua_Debug *ar)
static int countlevels(lua_State *L)
#define LEVELS2
#define LEVELS1
char short_src[LUA_IDSIZE]

References countlevels(), lua_Debug::currentline, lua_Debug::istailcall, lastlevel(), lastlevel(), LEVELS1, LEVELS2, lua_concat(), lua_getinfo(), lua_getstack(), lua_gettop(), lua_pushfstring(), lua_pushliteral, luaL_addchar, luaL_addstring(), luaL_addvalue(), luaL_buffinit(), luaL_checkstack(), luaL_pushresult(), NULL, pushfuncname(), pushfuncname(), pushfuncname(), and lua_Debug::short_src.

Referenced by db_traceback(), db_traceback(), db_traceback(), msghandler(), msghandler(), and traceback().

◆ luaL_typeerror()

LUALIB_API int luaL_typeerror ( lua_State * L,
int arg,
const char * tname )

Definition at line 193 of file lua-5.4.3/src/lauxlib.c.

193 {
194 const char *msg;
195 const char *typearg; /* name for the type of the actual argument */
196 if (luaL_getmetafield(L, arg, "__name") == LUA_TSTRING)
197 typearg = lua_tostring(L, -1); /* use the given type name */
198 else if (lua_type(L, arg) == LUA_TLIGHTUSERDATA)
199 typearg = "light userdata"; /* special name for messages */
200 else
201 typearg = luaL_typename(L, arg); /* standard name */
202 msg = lua_pushfstring(L, "%s expected, got %s", tname, typearg);
203 return luaL_argerror(L, arg, msg);
204}
CURL_EXTERN int void * arg
Definition curl.h:2622
#define LUA_TLIGHTUSERDATA
LUALIB_API int luaL_argerror(lua_State *L, int arg, const char *extramsg)
LUALIB_API int luaL_getmetafield(lua_State *L, int obj, const char *event)

References arg, lua_pushfstring(), LUA_TLIGHTUSERDATA, lua_tostring, LUA_TSTRING, lua_type(), luaL_argerror(), luaL_getmetafield(), and luaL_typename.

Referenced by tag_error().

◆ luaL_unref()

LUALIB_API void luaL_unref ( lua_State * L,
int t,
int ref )

◆ luaL_where()

LUALIB_API void luaL_where ( lua_State * L,
int lvl )

Definition at line 73 of file lua-5.1.5/src/lauxlib.c.

73 {
74 lua_Debug ar;
75 if (lua_getstack(L, level, &ar)) { /* check function at level */
76 lua_getinfo(L, "Sl", &ar); /* get info about it */
77 if (ar.currentline > 0) { /* is there info? */
78 lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline);
79 return;
80 }
81 }
82 lua_pushliteral(L, ""); /* else, no information available... */
83}

References lua_Debug::currentline, lua_getinfo(), lua_getstack(), lua_pushfstring(), lua_pushliteral, and lua_Debug::short_src.

Referenced by luaB_auxwrap(), luaB_auxwrap(), luaB_auxwrap(), luaB_auxwrap(), luaB_error(), luaB_error(), luaB_error(), luaB_error(), and luaL_error().