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 | 3 | ** Lua - A Scripting Language |
| 4 | 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) |
| 5 | 5 | ** See Copyright Notice at the end of this file |
| @@ -19,7 +19,7 @@ · 13 unmodified lines | ||
| 19 | 19 | #define LUA_VERSION_MAJOR "5" |
| 20 | 20 | #define LUA_VERSION_MINOR "3" |
| 21 | 21 | #define LUA_VERSION_NUM 503 |
| 22 | −#define LUA_VERSION_RELEASE "0 (work2)" | |
| 22 | +#define LUA_VERSION_RELEASE "0 (work3)" | |
| 23 | 23 | |
| 24 | 24 | #define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR |
| 25 | 25 | #define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE |
| @@ -53,8 +53,16 @@ · 27 unmodified lines | ||
| 53 | 53 | |
| 54 | 54 | typedef struct lua_State lua_State; |
| 55 | 55 | |
| 56 | +/* | |
| 57 | +** Type for C functions registered with Lua | |
| 58 | +*/ | |
| 56 | 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 | 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 | 153 | LUA_API int (lua_gettop) (lua_State *L); |
| 146 | 154 | LUA_API void (lua_settop) (lua_State *L, int idx); |
| 147 | 155 | LUA_API void (lua_pushvalue) (lua_State *L, int idx); |
| 148 | −LUA_API void (lua_remove) (lua_State *L, int idx); | |
| 149 | −LUA_API void (lua_insert) (lua_State *L, int idx); | |
| 156 | +LUA_API void (lua_rotate) (lua_State *L, int idx, int n); | |
| 150 | 157 | LUA_API void (lua_replace) (lua_State *L, int idx); |
| 151 | 158 | LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx); |
| 152 | 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 | 245 | LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); |
| 239 | 246 | LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); |
| 240 | 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 | 265 | ** 'load' and 'call' functions (load and run Lua code) |
| 259 | 266 | */ |
| 260 | 267 | LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, int ctx, |
| 261 | − lua_CFunction k); | |
| 268 | + lua_KFunction k); | |
| 262 | 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 | 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 | 273 | #define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL) |
| 269 | 274 | |
| 270 | 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 | 283 | ** coroutine functions |
| 279 | 284 | */ |
| 280 | 285 | LUA_API int (lua_yieldk) (lua_State *L, int nresults, int ctx, |
| 281 | − lua_CFunction k); | |
| 286 | + lua_KFunction k); | |
| 282 | 287 | #define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL) |
| 283 | 288 | LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg); |
| 284 | 289 | LUA_API int (lua_status) (lua_State *L); |
| 290 | +LUA_API int lua_isyieldable (lua_State *L); | |
| 291 | + | |
| 285 | 292 | |
| 286 | 293 | /* |
| 287 | 294 | ** garbage-collection function and options |
| @@ -311,7 +318,7 @@ LUA_API int (lua_next) (lua_State *L, int idx); · 23 unmodified lines | ||
| 311 | 318 | LUA_API void (lua_concat) (lua_State *L, int n); |
| 312 | 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 | 323 | LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); |
| 317 | 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) | |
| 328 | −#define lua_tointeger(L,i) lua_tointegerx(L,i,NULL) | |
| 329 | −#define lua_tounsigned(L,i) lua_tounsignedx(L,i,NULL) | |
| 334 | +#define lua_tonumber(L,i) lua_tonumberx(L,(i),NULL) | |
| 335 | +#define lua_tointeger(L,i) lua_tointegerx(L,(i),NULL) | |
| 336 | +#define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL) | |
| 330 | 337 | |
| 331 | 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 | 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 | ** {====================================================================== |