History

Lua 5.3.0-work3

Lua Team committed 12 years ago

Commit f8a66271 parent ad386d945 files · +2323 −1590Browse files

Showing the changes to src/lua.h (1 of 45 files). Show all

Unified · Split

src/lua.h+25−14
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lua.h,v 1.302 2014/03/20 19:42:35 roberto Exp $2** $Id: lua.h,v 1.307 2014/06/10 17:41:38 roberto Exp $
3** Lua - A Scripting Language3** Lua - A Scripting Language
4** Lua.org, PUC-Rio, Brazil (http://www.lua.org)4** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
5** See Copyright Notice at the end of this file5** See Copyright Notice at the end of this file
@@ -19,7 +19,7 @@ · 13 unmodified lines
19#define LUA_VERSION_MAJOR "5"19#define LUA_VERSION_MAJOR "5"
20#define LUA_VERSION_MINOR "3"20#define LUA_VERSION_MINOR "3"
21#define LUA_VERSION_NUM 50321#define LUA_VERSION_NUM 503
22#define LUA_VERSION_RELEASE "0 (work2)"22#define LUA_VERSION_RELEASE "0 (work3)"
23 23
24#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR24#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
25#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE25#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
@@ -53,8 +53,16 @@ · 27 unmodified lines
53 53
54typedef struct lua_State lua_State;54typedef struct lua_State lua_State;
55 55
56/*
57** Type for C functions registered with Lua
58*/
56typedef int (*lua_CFunction) (lua_State *L);59typedef int (*lua_CFunction) (lua_State *L);
57 60
61/*
62** Type for continuation functions
63*/
64typedef int (*lua_KFunction) (lua_State *L, int status, int ctx);
65
58 66
59/*67/*
60** functions that read/write blocks when loading/dumping Lua chunks68** functions that read/write blocks when loading/dumping Lua chunks
@@ -145,8 +153,7 @@ LUA_API int (lua_absindex) (lua_State *L, int idx); · 84 unmodified lines
145LUA_API int (lua_gettop) (lua_State *L);153LUA_API int (lua_gettop) (lua_State *L);
146LUA_API void (lua_settop) (lua_State *L, int idx);154LUA_API void (lua_settop) (lua_State *L, int idx);
147LUA_API void (lua_pushvalue) (lua_State *L, int idx);155LUA_API void (lua_pushvalue) (lua_State *L, int idx);
148LUA_API void (lua_remove) (lua_State *L, int idx);156LUA_API void (lua_rotate) (lua_State *L, int idx, int n);
149LUA_API void (lua_insert) (lua_State *L, int idx);
150LUA_API void (lua_replace) (lua_State *L, int idx);157LUA_API void (lua_replace) (lua_State *L, int idx);
151LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx);158LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx);
152LUA_API int (lua_checkstack) (lua_State *L, int sz);159LUA_API int (lua_checkstack) (lua_State *L, int sz);
@@ -238,7 +245,7 @@ LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p); · 85 unmodified lines
238LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);245LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);
239LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);246LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
240LUA_API int (lua_getmetatable) (lua_State *L, int objindex);247LUA_API int (lua_getmetatable) (lua_State *L, int objindex);
241LUA_API void (lua_getuservalue) (lua_State *L, int idx);248LUA_API int (lua_getuservalue) (lua_State *L, int idx);
242 249
243 250
244/*251/*
@@ -258,13 +265,11 @@ LUA_API void (lua_setuservalue) (lua_State *L, int idx); · 13 unmodified lines
258** 'load' and 'call' functions (load and run Lua code)265** 'load' and 'call' functions (load and run Lua code)
259*/266*/
260LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, int ctx,267LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, int ctx,
261 lua_CFunction k);268 lua_KFunction k);
262#define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL)269#define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL)
263 270
264LUA_API int (lua_getctx) (lua_State *L, int *ctx);
265
266LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc,271LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc,
267 int ctx, lua_CFunction k);272 int ctx, lua_KFunction k);
268#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL)273#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL)
269 274
270LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt,275LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt,
@@ -278,10 +283,12 @@ LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip); · 7 unmodified lines
278** coroutine functions283** coroutine functions
279*/284*/
280LUA_API int (lua_yieldk) (lua_State *L, int nresults, int ctx,285LUA_API int (lua_yieldk) (lua_State *L, int nresults, int ctx,
281 lua_CFunction k);286 lua_KFunction k);
282#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL)287#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL)
283LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg);288LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg);
284LUA_API int (lua_status) (lua_State *L);289LUA_API int (lua_status) (lua_State *L);
290LUA_API int lua_isyieldable (lua_State *L);
291
285 292
286/*293/*
287** garbage-collection function and options294** garbage-collection function and options
@@ -311,7 +318,7 @@ LUA_API int (lua_next) (lua_State *L, int idx); · 23 unmodified lines
311LUA_API void (lua_concat) (lua_State *L, int n);318LUA_API void (lua_concat) (lua_State *L, int n);
312LUA_API void (lua_len) (lua_State *L, int idx);319LUA_API void (lua_len) (lua_State *L, int idx);
313 320
314LUA_API int (lua_strtonum) (lua_State *L, const char *s, size_t len);321LUA_API size_t (lua_strtonum) (lua_State *L, const char *s);
315 322
316LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);323LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
317LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);324LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud);
@@ -324,9 +331,9 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); · 6 unmodified lines
324** ===============================================================331** ===============================================================
325*/332*/
326 333
327#define lua_tonumber(L,i) lua_tonumberx(L,i,NULL)334#define lua_tonumber(L,i) lua_tonumberx(L,(i),NULL)
328#define lua_tointeger(L,i) lua_tointegerx(L,i,NULL)335#define lua_tointeger(L,i) lua_tointegerx(L,(i),NULL)
329#define lua_tounsigned(L,i) lua_tounsignedx(L,i,NULL)336#define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL)
330 337
331#define lua_pop(L,n) lua_settop(L, -(n)-1)338#define lua_pop(L,n) lua_settop(L, -(n)-1)
332 339
@@ -354,6 +361,10 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); · 21 unmodified lines
354#define lua_tostring(L,i) lua_tolstring(L, (i), NULL)361#define lua_tostring(L,i) lua_tolstring(L, (i), NULL)
355 362
356 363
364#define lua_insert(L,idx) lua_rotate(L, (idx), 1)
365
366#define lua_remove(L,idx) (lua_rotate(L, (idx), -1), lua_pop(L, 1))
367
357 368
358/*369/*
359** {======================================================================370** {======================================================================