Showing the changes to src/lua.h (1 of 45 files). Show all
Unified · Split
| @@ -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 Language | 3 | ** 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 file | 5 | ** 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 503 | 21 | #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_MINOR | 24 | #define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR |
| 25 | #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE | 25 | #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE |
| @@ -53,8 +53,16 @@ · 27 unmodified lines | |||
| 53 | 53 | ||
| 54 | typedef struct lua_State lua_State; | 54 | typedef struct lua_State lua_State; |
| 55 | 55 | ||
| 56 | /* | ||
| 57 | ** Type for C functions registered with Lua | ||
| 58 | */ | ||
| 56 | typedef int (*lua_CFunction) (lua_State *L); | 59 | typedef int (*lua_CFunction) (lua_State *L); |
| 57 | 60 | ||
| 61 | /* | ||
| 62 | ** Type for continuation functions | ||
| 63 | */ | ||
| 64 | typedef 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 chunks | 68 | ** 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 | |||
| 145 | LUA_API int (lua_gettop) (lua_State *L); | 153 | LUA_API int (lua_gettop) (lua_State *L); |
| 146 | LUA_API void (lua_settop) (lua_State *L, int idx); | 154 | LUA_API void (lua_settop) (lua_State *L, int idx); |
| 147 | LUA_API void (lua_pushvalue) (lua_State *L, int idx); | 155 | LUA_API void (lua_pushvalue) (lua_State *L, int idx); |
| 148 | LUA_API void (lua_remove) (lua_State *L, int idx); | 156 | LUA_API void (lua_rotate) (lua_State *L, int idx, int n); |
| 149 | LUA_API void (lua_insert) (lua_State *L, int idx); | ||
| 150 | LUA_API void (lua_replace) (lua_State *L, int idx); | 157 | LUA_API void (lua_replace) (lua_State *L, int idx); |
| 151 | LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx); | 158 | LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx); |
| 152 | LUA_API int (lua_checkstack) (lua_State *L, int sz); | 159 | LUA_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 | |||
| 238 | LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); | 245 | LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); |
| 239 | LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); | 246 | LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); |
| 240 | LUA_API int (lua_getmetatable) (lua_State *L, int objindex); | 247 | LUA_API int (lua_getmetatable) (lua_State *L, int objindex); |
| 241 | LUA_API void (lua_getuservalue) (lua_State *L, int idx); | 248 | LUA_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 | */ |
| 260 | LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, int ctx, | 267 | LUA_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 | ||
| 264 | LUA_API int (lua_getctx) (lua_State *L, int *ctx); | ||
| 265 | |||
| 266 | LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, | 271 | LUA_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 | ||
| 270 | LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, | 275 | LUA_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 functions | 283 | ** coroutine functions |
| 279 | */ | 284 | */ |
| 280 | LUA_API int (lua_yieldk) (lua_State *L, int nresults, int ctx, | 285 | LUA_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) |
| 283 | LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg); | 288 | LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg); |
| 284 | LUA_API int (lua_status) (lua_State *L); | 289 | LUA_API int (lua_status) (lua_State *L); |
| 290 | LUA_API int lua_isyieldable (lua_State *L); | ||
| 291 | |||
| 285 | 292 | ||
| 286 | /* | 293 | /* |
| 287 | ** garbage-collection function and options | 294 | ** garbage-collection function and options |
| @@ -311,7 +318,7 @@ LUA_API int (lua_next) (lua_State *L, int idx); · 23 unmodified lines | |||
| 311 | LUA_API void (lua_concat) (lua_State *L, int n); | 318 | LUA_API void (lua_concat) (lua_State *L, int n); |
| 312 | LUA_API void (lua_len) (lua_State *L, int idx); | 319 | LUA_API void (lua_len) (lua_State *L, int idx); |
| 313 | 320 | ||
| 314 | LUA_API int (lua_strtonum) (lua_State *L, const char *s, size_t len); | 321 | LUA_API size_t (lua_strtonum) (lua_State *L, const char *s); |
| 315 | 322 | ||
| 316 | LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); | 323 | LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); |
| 317 | LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); | 324 | LUA_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 | ** {====================================================================== |