1
1
/*
2
+ ** $Id: lua.h $
2
3
** Lua - A Scripting Language
3
4
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
4
5
** See Copyright Notice at the end of this file
16
17
17
18
18
19
#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)
22
25
23
26
#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
24
27
#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
48
51
#define LUA_ERRRUN 2
49
52
#define LUA_ERRSYNTAX 3
50
53
#define LUA_ERRMEM 4
51
- #define LUA_ERRGCMM 5
52
- #define LUA_ERRERR 6
54
+ #define LUA_ERRERR 5
53
55
54
56
55
57
typedef struct lua_State lua_State ;
@@ -70,7 +72,7 @@ typedef struct lua_State lua_State;
70
72
#define LUA_TUSERDATA 7
71
73
#define LUA_TTHREAD 8
72
74
73
- #define LUA_NUMTAGS 9
75
+ #define LUA_NUMTYPES 9
74
76
75
77
76
78
@@ -123,6 +125,13 @@ typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud);
123
125
typedef void * (* lua_Alloc ) (void * ud , void * ptr , size_t osize , size_t nsize );
124
126
125
127
128
+ /*
129
+ ** Type for warning functions
130
+ */
131
+ typedef void (* lua_WarnFunction ) (void * ud , const char * msg , int tocont );
132
+
133
+
134
+
126
135
127
136
/*
128
137
** generic extra include file
@@ -144,11 +153,12 @@ extern const char lua_ident[];
144
153
LUA_API lua_State * (lua_newstate ) (lua_Alloc f , void * ud );
145
154
LUA_API void (lua_close ) (lua_State * L );
146
155
LUA_API lua_State * (lua_newthread ) (lua_State * L );
156
+ LUA_API int (lua_resetthread ) (lua_State * L );
147
157
148
158
LUA_API lua_CFunction (lua_atpanic ) (lua_State * L , lua_CFunction panicf );
149
159
150
160
151
- LUA_API const lua_Number * (lua_version ) (lua_State * L );
161
+ LUA_API lua_Number (lua_version ) (lua_State * L );
152
162
153
163
154
164
/*
@@ -181,7 +191,7 @@ LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum);
181
191
LUA_API lua_Integer (lua_tointegerx ) (lua_State * L , int idx , int * isnum );
182
192
LUA_API int (lua_toboolean ) (lua_State * L , int idx );
183
193
LUA_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 );
185
195
LUA_API lua_CFunction (lua_tocfunction ) (lua_State * L , int idx );
186
196
LUA_API void * (lua_touserdata ) (lua_State * L , int idx );
187
197
LUA_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);
246
256
LUA_API int (lua_rawgetp ) (lua_State * L , int idx , const void * p );
247
257
248
258
LUA_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 );
250
260
LUA_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 );
252
262
253
263
254
264
/*
@@ -262,7 +272,7 @@ LUA_API void (lua_rawset) (lua_State *L, int idx);
262
272
LUA_API void (lua_rawseti ) (lua_State * L , int idx , lua_Integer n );
263
273
LUA_API void (lua_rawsetp ) (lua_State * L , int idx , const void * p );
264
274
LUA_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 );
266
276
267
277
268
278
/*
@@ -287,13 +297,21 @@ LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip);
287
297
*/
288
298
LUA_API int (lua_yieldk ) (lua_State * L , int nresults , lua_KContext ctx ,
289
299
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 );
291
302
LUA_API int (lua_status ) (lua_State * L );
292
303
LUA_API int (lua_isyieldable ) (lua_State * L );
293
304
294
305
#define lua_yield (L ,n ) lua_yieldk(L, (n), 0, NULL)
295
306
296
307
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
+
297
315
/*
298
316
** garbage-collection function and options
299
317
*/
@@ -307,8 +325,10 @@ LUA_API int (lua_isyieldable) (lua_State *L);
307
325
#define LUA_GCSETPAUSE 6
308
326
#define LUA_GCSETSTEPMUL 7
309
327
#define LUA_GCISRUNNING 9
328
+ #define LUA_GCGEN 10
329
+ #define LUA_GCINC 11
310
330
311
- LUA_API int (lua_gc ) (lua_State * L , int what , int data );
331
+ LUA_API int (lua_gc ) (lua_State * L , int what , ... );
312
332
313
333
314
334
/*
@@ -327,6 +347,7 @@ LUA_API size_t (lua_stringtonumber) (lua_State *L, const char *s);
327
347
LUA_API lua_Alloc (lua_getallocf ) (lua_State * L , void * * ud );
328
348
LUA_API void (lua_setallocf ) (lua_State * L , lua_Alloc f , void * ud );
329
349
350
+ LUA_API void (lua_toclose ) (lua_State * L , int idx );
330
351
331
352
332
353
/*
@@ -376,7 +397,7 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
376
397
377
398
/*
378
399
** {==============================================================
379
- ** compatibility macros for unsigned conversions
400
+ ** compatibility macros
380
401
** ===============================================================
381
402
*/
382
403
#if defined(LUA_COMPAT_APIINTCASTS )
@@ -386,6 +407,13 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
386
407
#define lua_tounsigned (L ,i ) lua_tounsignedx(L,(i),NULL)
387
408
388
409
#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
+
389
417
/* }============================================================== */
390
418
391
419
/*
@@ -436,20 +464,24 @@ LUA_API lua_Hook (lua_gethook) (lua_State *L);
436
464
LUA_API int (lua_gethookmask ) (lua_State * L );
437
465
LUA_API int (lua_gethookcount ) (lua_State * L );
438
466
467
+ LUA_API int (lua_setcstacklimit ) (lua_State * L , unsigned int limit );
439
468
440
469
struct lua_Debug {
441
470
int event ;
442
471
const char * name ; /* (n) */
443
472
const char * namewhat ; /* (n) 'global', 'local', 'field', 'method' */
444
473
const char * what ; /* (S) 'Lua', 'C', 'main', 'tail' */
445
474
const char * source ; /* (S) */
475
+ size_t srclen ; /* (S) */
446
476
int currentline ; /* (l) */
447
477
int linedefined ; /* (S) */
448
478
int lastlinedefined ; /* (S) */
449
479
unsigned char nups ; /* (u) number of upvalues */
450
480
unsigned char nparams ;/* (u) number of parameters */
451
481
char isvararg ; /* (u) */
452
482
char istailcall ; /* (t) */
483
+ unsigned short ftransfer ; /* (r) index of first value transferred */
484
+ unsigned short ntransfer ; /* (r) number of transferred values */
453
485
char short_src [LUA_IDSIZE ]; /* (S) */
454
486
/* private part */
455
487
struct CallInfo * i_ci ; /* active function */
0 commit comments