23#define LUA_VERSION_MAJOR "5"
24#define LUA_VERSION_MINOR "4"
25#define LUA_VERSION_RELEASE "6"
27#define LUA_VERSION_NUM 504
28#define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 6)
30#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
31#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
32#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2023 Lua.org, PUC-Rio"
33#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
37#define LUA_SIGNATURE "\x1bLua"
40#define LUA_MULTRET (-1)
48#define LUA_REGISTRYINDEX (-LUAI_MAXSTACK - 1000)
49#define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i))
56#define LUA_ERRSYNTAX 3
71#define LUA_TLIGHTUSERDATA 2
75#define LUA_TFUNCTION 6
76#define LUA_TUSERDATA 7
84#define LUA_MINSTACK 20
88#define LUA_RIDX_MAINTHREAD 1
89#define LUA_RIDX_GLOBALS 2
90#define LUA_RIDX_LAST LUA_RIDX_GLOBALS
94typedef LUA_NUMBER lua_Number;
98typedef LUA_INTEGER lua_Integer;
101typedef LUA_UNSIGNED lua_Unsigned;
104typedef LUA_KCONTEXT lua_KContext;
110typedef int (*lua_CFunction) (
lua_State *L);
115typedef int (*lua_KFunction) (
lua_State *L,
int status, lua_KContext ctx);
121typedef const char * (*lua_Reader) (
lua_State *L,
void *ud,
size_t *sz);
123typedef int (*lua_Writer) (
lua_State *L,
const void *p,
size_t sz,
void *ud);
129typedef void * (*lua_Alloc) (
void *ud,
void *ptr,
size_t osize,
size_t nsize);
135typedef void (*lua_WarnFunction) (
void *ud,
const char *msg,
int tocont);
153#if defined(LUA_USER_H)
161extern const char lua_ident[];
167LUA_API
lua_State *(lua_newstate) (lua_Alloc f,
void *ud);
171LUA_API int (lua_resetthread) (
lua_State *L);
173LUA_API lua_CFunction (lua_atpanic) (
lua_State *L, lua_CFunction panicf);
176LUA_API lua_Number (lua_version) (
lua_State *L);
182LUA_API int (lua_absindex) (
lua_State *L,
int idx);
184LUA_API void (lua_settop) (
lua_State *L,
int idx);
185LUA_API void (lua_pushvalue) (
lua_State *L,
int idx);
186LUA_API void (lua_rotate) (
lua_State *L,
int idx,
int n);
187LUA_API void (lua_copy) (
lua_State *L,
int fromidx,
int toidx);
188LUA_API int (lua_checkstack) (
lua_State *L,
int n);
197LUA_API int (lua_isnumber) (
lua_State *L,
int idx);
198LUA_API int (lua_isstring) (
lua_State *L,
int idx);
199LUA_API int (lua_iscfunction) (
lua_State *L,
int idx);
200LUA_API int (lua_isinteger) (
lua_State *L,
int idx);
201LUA_API int (lua_isuserdata) (
lua_State *L,
int idx);
202LUA_API int (lua_type) (
lua_State *L,
int idx);
203LUA_API
const char *(lua_typename) (
lua_State *L,
int tp);
205LUA_API lua_Number (lua_tonumberx) (
lua_State *L,
int idx,
int *isnum);
206LUA_API lua_Integer (lua_tointegerx) (
lua_State *L,
int idx,
int *isnum);
207LUA_API int (lua_toboolean) (
lua_State *L,
int idx);
208LUA_API
const char *(lua_tolstring) (
lua_State *L,
int idx,
size_t *len);
209LUA_API lua_Unsigned (lua_rawlen) (
lua_State *L,
int idx);
210LUA_API lua_CFunction (lua_tocfunction) (
lua_State *L,
int idx);
211LUA_API
void *(lua_touserdata) (
lua_State *L,
int idx);
213LUA_API
const void *(lua_topointer) (
lua_State *L,
int idx);
235LUA_API void (lua_arith) (
lua_State *L,
int op);
241LUA_API int (lua_rawequal) (
lua_State *L,
int idx1,
int idx2);
242LUA_API int (lua_compare) (
lua_State *L,
int idx1,
int idx2,
int op);
248LUA_API void (lua_pushnil) (
lua_State *L);
249LUA_API void (lua_pushnumber) (
lua_State *L, lua_Number n);
250LUA_API void (lua_pushinteger) (
lua_State *L, lua_Integer n);
251LUA_API
const char *(lua_pushlstring) (
lua_State *L,
const char *s,
size_t len);
252LUA_API
const char *(lua_pushstring) (
lua_State *L,
const char *s);
253LUA_API
const char *(lua_pushvfstring) (
lua_State *L,
const char *fmt,
255LUA_API
const char *(lua_pushfstring) (
lua_State *L,
const char *fmt, ...);
256LUA_API void (lua_pushcclosure) (
lua_State *L, lua_CFunction fn,
int n);
257LUA_API void (lua_pushboolean) (
lua_State *L,
int b);
258LUA_API void (lua_pushlightuserdata) (
lua_State *L,
void *p);
259LUA_API int (lua_pushthread) (
lua_State *L);
265LUA_API int (lua_getglobal) (
lua_State *L,
const char *name);
266LUA_API int (lua_gettable) (
lua_State *L,
int idx);
267LUA_API int (lua_getfield) (
lua_State *L,
int idx,
const char *k);
268LUA_API int (lua_geti) (
lua_State *L,
int idx, lua_Integer n);
269LUA_API int (lua_rawget) (
lua_State *L,
int idx);
270LUA_API int (lua_rawgeti) (
lua_State *L,
int idx, lua_Integer n);
271LUA_API int (lua_rawgetp) (
lua_State *L,
int idx,
const void *p);
273LUA_API void (lua_createtable) (
lua_State *L,
int narr,
int nrec);
274LUA_API
void *(lua_newuserdatauv) (
lua_State *L,
size_t sz,
int nuvalue);
275LUA_API int (lua_getmetatable) (
lua_State *L,
int objindex);
276LUA_API int (lua_getiuservalue) (
lua_State *L,
int idx,
int n);
282LUA_API void (lua_setglobal) (
lua_State *L,
const char *name);
283LUA_API void (lua_settable) (
lua_State *L,
int idx);
284LUA_API void (lua_setfield) (
lua_State *L,
int idx,
const char *k);
285LUA_API void (lua_seti) (
lua_State *L,
int idx, lua_Integer n);
286LUA_API void (lua_rawset) (
lua_State *L,
int idx);
287LUA_API void (lua_rawseti) (
lua_State *L,
int idx, lua_Integer n);
288LUA_API void (lua_rawsetp) (
lua_State *L,
int idx,
const void *p);
289LUA_API int (lua_setmetatable) (
lua_State *L,
int objindex);
290LUA_API int (lua_setiuservalue) (
lua_State *L,
int idx,
int n);
296LUA_API void (lua_callk) (
lua_State *L,
int nargs,
int nresults,
297 lua_KContext ctx, lua_KFunction k);
298#define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL)
300LUA_API int (lua_pcallk) (
lua_State *L,
int nargs,
int nresults,
int errfunc,
301 lua_KContext ctx, lua_KFunction k);
302#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL)
304LUA_API int (lua_load) (
lua_State *L, lua_Reader reader,
void *dt,
305 const char *chunkname,
const char *mode);
307LUA_API int (lua_dump) (
lua_State *L, lua_Writer writer,
void *data,
int strip);
313LUA_API int (lua_yieldk) (
lua_State *L,
int nresults, lua_KContext ctx,
318LUA_API int (lua_isyieldable) (
lua_State *L);
320#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL)
326LUA_API void (lua_setwarnf) (
lua_State *L, lua_WarnFunction f,
void *ud);
327LUA_API void (lua_warning) (
lua_State *L,
const char *msg,
int tocont);
335#define LUA_GCRESTART 1
336#define LUA_GCCOLLECT 2
338#define LUA_GCCOUNTB 4
340#define LUA_GCSETPAUSE 6
341#define LUA_GCSETSTEPMUL 7
342#define LUA_GCISRUNNING 9
346LUA_API int (lua_gc) (
lua_State *L,
int what, ...);
355LUA_API int (lua_next) (
lua_State *L,
int idx);
357LUA_API void (lua_concat) (
lua_State *L,
int n);
358LUA_API void (lua_len) (
lua_State *L,
int idx);
360LUA_API size_t (lua_stringtonumber) (
lua_State *L,
const char *s);
362LUA_API lua_Alloc (lua_getallocf) (
lua_State *L,
void **ud);
363LUA_API void (lua_setallocf) (
lua_State *L, lua_Alloc f,
void *ud);
365LUA_API void (lua_toclose) (
lua_State *L,
int idx);
366LUA_API void (lua_closeslot) (
lua_State *L,
int idx);
375#define lua_getextraspace(L) ((void *)((char *)(L) - LUA_EXTRASPACE))
377#define lua_tonumber(L,i) lua_tonumberx(L,(i),NULL)
378#define lua_tointeger(L,i) lua_tointegerx(L,(i),NULL)
380#define lua_pop(L,n) lua_settop(L, -(n)-1)
382#define lua_newtable(L) lua_createtable(L, 0, 0)
384#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))
386#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
388#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION)
389#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE)
390#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
391#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL)
392#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN)
393#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD)
394#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE)
395#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0)
397#define lua_pushliteral(L, s) lua_pushstring(L, "" s)
399#define lua_pushglobaltable(L) \
400 ((void)lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS))
402#define lua_tostring(L,i) lua_tolstring(L, (i), NULL)
405#define lua_insert(L,idx) lua_rotate(L, (idx), 1)
407#define lua_remove(L,idx) (lua_rotate(L, (idx), -1), lua_pop(L, 1))
409#define lua_replace(L,idx) (lua_copy(L, -1, (idx)), lua_pop(L, 1))
419#if defined(LUA_COMPAT_APIINTCASTS)
421#define lua_pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n))
422#define lua_tounsignedx(L,i,is) ((lua_Unsigned)lua_tointegerx(L,i,is))
423#define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL)
427#define lua_newuserdata(L,s) lua_newuserdatauv(L,s,1)
428#define lua_getuservalue(L,idx) lua_getiuservalue(L,idx,1)
429#define lua_setuservalue(L,idx) lua_setiuservalue(L,idx,1)
431#define LUA_NUMTAGS LUA_NUMTYPES
445#define LUA_HOOKCALL 0
447#define LUA_HOOKLINE 2
448#define LUA_HOOKCOUNT 3
449#define LUA_HOOKTAILCALL 4
455#define LUA_MASKCALL (1 << LUA_HOOKCALL)
456#define LUA_MASKRET (1 << LUA_HOOKRET)
457#define LUA_MASKLINE (1 << LUA_HOOKLINE)
458#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
465LUA_API
const char *(lua_getupvalue) (
lua_State *L,
int funcindex,
int n);
466LUA_API
const char *(lua_setupvalue) (
lua_State *L,
int funcindex,
int n);
468LUA_API
void *(lua_upvalueid) (
lua_State *L,
int fidx,
int n);
469LUA_API void (lua_upvaluejoin) (
lua_State *L,
int fidx1,
int n1,
472LUA_API void (lua_sethook) (
lua_State *L, lua_Hook func,
int mask,
int count);
473LUA_API lua_Hook (lua_gethook) (
lua_State *L);
474LUA_API int (lua_gethookmask) (
lua_State *L);
475LUA_API int (lua_gethookcount) (
lua_State *L);
477LUA_API int (lua_setcstacklimit) (
lua_State *L,
unsigned int limit);
482 const char *namewhat;
490 unsigned char nparams;
493 unsigned short ftransfer;
494 unsigned short ntransfer;
495 char short_src[LUA_IDSIZE];