11/*
2+ ** $Id: lua.h $
23** Lua - A Scripting Language
34** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
45** See Copyright Notice at the end of this file
1617
1718
1819#define LUA_VERSION_MAJOR "5"
19- #define LUA_VERSION_MINOR "3"
20- #define LUA_VERSION_NUM 503
21- #define LUA_VERSION_RELEASE "6"
20+ #define LUA_VERSION_MINOR "4"
21+ #define LUA_VERSION_RELEASE "2"
22+
23+ #define LUA_VERSION_NUM 504
24+ #define LUA_VERSION_RELEASE_NUM (LUA_VERSION_NUM * 100 + 0)
2225
2326#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
2427#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
4851#define LUA_ERRRUN 2
4952#define LUA_ERRSYNTAX 3
5053#define LUA_ERRMEM 4
51- #define LUA_ERRGCMM 5
52- #define LUA_ERRERR 6
54+ #define LUA_ERRERR 5
5355
5456
5557typedef struct lua_State lua_State ;
@@ -70,7 +72,7 @@ typedef struct lua_State lua_State;
7072#define LUA_TUSERDATA 7
7173#define LUA_TTHREAD 8
7274
73- #define LUA_NUMTAGS 9
75+ #define LUA_NUMTYPES 9
7476
7577
7678
@@ -123,6 +125,13 @@ typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud);
123125typedef void * (* lua_Alloc ) (void * ud , void * ptr , size_t osize , size_t nsize );
124126
125127
128+ /*
129+ ** Type for warning functions
130+ */
131+ typedef void (* lua_WarnFunction ) (void * ud , const char * msg , int tocont );
132+
133+
134+
126135
127136/*
128137** generic extra include file
@@ -144,11 +153,12 @@ extern const char lua_ident[];
144153LUA_API lua_State * (lua_newstate ) (lua_Alloc f , void * ud );
145154LUA_API void (lua_close ) (lua_State * L );
146155LUA_API lua_State * (lua_newthread ) (lua_State * L );
156+ LUA_API int (lua_resetthread ) (lua_State * L );
147157
148158LUA_API lua_CFunction (lua_atpanic ) (lua_State * L , lua_CFunction panicf );
149159
150160
151- LUA_API const lua_Number * (lua_version ) (lua_State * L );
161+ LUA_API lua_Number (lua_version ) (lua_State * L );
152162
153163
154164/*
@@ -181,7 +191,7 @@ LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum);
181191LUA_API lua_Integer (lua_tointegerx ) (lua_State * L , int idx , int * isnum );
182192LUA_API int (lua_toboolean ) (lua_State * L , int idx );
183193LUA_API const char * (lua_tolstring ) (lua_State * L , int idx , size_t * len );
184- LUA_API size_t (lua_rawlen ) (lua_State * L , int idx );
194+ LUA_API lua_Unsigned (lua_rawlen ) (lua_State * L , int idx );
185195LUA_API lua_CFunction (lua_tocfunction ) (lua_State * L , int idx );
186196LUA_API void * (lua_touserdata ) (lua_State * L , int idx );
187197LUA_API lua_State * (lua_tothread ) (lua_State * L , int idx );
@@ -246,9 +256,9 @@ LUA_API int (lua_rawgeti) (lua_State *L, int idx, lua_Integer n);
246256LUA_API int (lua_rawgetp ) (lua_State * L , int idx , const void * p );
247257
248258LUA_API void (lua_createtable ) (lua_State * L , int narr , int nrec );
249- LUA_API void * (lua_newuserdata ) (lua_State * L , size_t sz );
259+ LUA_API void * (lua_newuserdatauv ) (lua_State * L , size_t sz , int nuvalue );
250260LUA_API int (lua_getmetatable ) (lua_State * L , int objindex );
251- LUA_API int (lua_getuservalue ) (lua_State * L , int idx );
261+ LUA_API int (lua_getiuservalue ) (lua_State * L , int idx , int n );
252262
253263
254264/*
@@ -262,7 +272,7 @@ LUA_API void (lua_rawset) (lua_State *L, int idx);
262272LUA_API void (lua_rawseti ) (lua_State * L , int idx , lua_Integer n );
263273LUA_API void (lua_rawsetp ) (lua_State * L , int idx , const void * p );
264274LUA_API int (lua_setmetatable ) (lua_State * L , int objindex );
265- LUA_API void ( lua_setuservalue ) (lua_State * L , int idx );
275+ LUA_API int ( lua_setiuservalue ) (lua_State * L , int idx , int n );
266276
267277
268278/*
@@ -287,13 +297,21 @@ LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip);
287297*/
288298LUA_API int (lua_yieldk ) (lua_State * L , int nresults , lua_KContext ctx ,
289299 lua_KFunction k );
290- LUA_API int (lua_resume ) (lua_State * L , lua_State * from , int narg );
300+ LUA_API int (lua_resume ) (lua_State * L , lua_State * from , int narg ,
301+ int * nres );
291302LUA_API int (lua_status ) (lua_State * L );
292303LUA_API int (lua_isyieldable ) (lua_State * L );
293304
294305#define lua_yield (L ,n ) lua_yieldk(L, (n), 0, NULL)
295306
296307
308+ /*
309+ ** Warning-related functions
310+ */
311+ LUA_API void (lua_setwarnf ) (lua_State * L , lua_WarnFunction f , void * ud );
312+ LUA_API void (lua_warning ) (lua_State * L , const char * msg , int tocont );
313+
314+
297315/*
298316** garbage-collection function and options
299317*/
@@ -307,8 +325,10 @@ LUA_API int (lua_isyieldable) (lua_State *L);
307325#define LUA_GCSETPAUSE 6
308326#define LUA_GCSETSTEPMUL 7
309327#define LUA_GCISRUNNING 9
328+ #define LUA_GCGEN 10
329+ #define LUA_GCINC 11
310330
311- LUA_API int (lua_gc ) (lua_State * L , int what , int data );
331+ LUA_API int (lua_gc ) (lua_State * L , int what , ... );
312332
313333
314334/*
@@ -327,6 +347,7 @@ LUA_API size_t (lua_stringtonumber) (lua_State *L, const char *s);
327347LUA_API lua_Alloc (lua_getallocf ) (lua_State * L , void * * ud );
328348LUA_API void (lua_setallocf ) (lua_State * L , lua_Alloc f , void * ud );
329349
350+ LUA_API void (lua_toclose ) (lua_State * L , int idx );
330351
331352
332353/*
@@ -376,7 +397,7 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
376397
377398/*
378399** {==============================================================
379- ** compatibility macros for unsigned conversions
400+ ** compatibility macros
380401** ===============================================================
381402*/
382403#if defined(LUA_COMPAT_APIINTCASTS )
@@ -386,6 +407,13 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
386407#define lua_tounsigned (L ,i ) lua_tounsignedx(L,(i),NULL)
387408
388409#endif
410+
411+ #define lua_newuserdata (L ,s ) lua_newuserdatauv(L,s,1)
412+ #define lua_getuservalue (L ,idx ) lua_getiuservalue(L,idx,1)
413+ #define lua_setuservalue (L ,idx ) lua_setiuservalue(L,idx,1)
414+
415+ #define LUA_NUMTAGS LUA_NUMTYPES
416+
389417/* }============================================================== */
390418
391419/*
@@ -436,20 +464,24 @@ LUA_API lua_Hook (lua_gethook) (lua_State *L);
436464LUA_API int (lua_gethookmask ) (lua_State * L );
437465LUA_API int (lua_gethookcount ) (lua_State * L );
438466
467+ LUA_API int (lua_setcstacklimit ) (lua_State * L , unsigned int limit );
439468
440469struct lua_Debug {
441470 int event ;
442471 const char * name ; /* (n) */
443472 const char * namewhat ; /* (n) 'global', 'local', 'field', 'method' */
444473 const char * what ; /* (S) 'Lua', 'C', 'main', 'tail' */
445474 const char * source ; /* (S) */
475+ size_t srclen ; /* (S) */
446476 int currentline ; /* (l) */
447477 int linedefined ; /* (S) */
448478 int lastlinedefined ; /* (S) */
449479 unsigned char nups ; /* (u) number of upvalues */
450480 unsigned char nparams ;/* (u) number of parameters */
451481 char isvararg ; /* (u) */
452482 char istailcall ; /* (t) */
483+ unsigned short ftransfer ; /* (r) index of first value transferred */
484+ unsigned short ntransfer ; /* (r) number of transferred values */
453485 char short_src [LUA_IDSIZE ]; /* (S) */
454486 /* private part */
455487 struct CallInfo * i_ci ; /* active function */
0 commit comments