Showing the changes to src/lua.h (1 of 77 files). Show all
Unified · Split
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lua.h,v 1.261 2010/01/11 17:15:11 roberto Exp $ | |
| 2 | +** $Id: lua.h,v 1.270 2010/05/12 14:09:20 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 |
| @@ -17,7 +17,7 @@ · 11 unmodified lines | ||
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | #define LUA_VERSION "Lua 5.2" |
| 20 | −#define LUA_RELEASE "Lua 5.2.0 (work2)" | |
| 20 | +#define LUA_RELEASE "Lua 5.2.0 (work3)" | |
| 21 | 21 | #define LUA_VERSION_NUM 502 |
| 22 | 22 | #define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2010 Lua.org, PUC-Rio" |
| 23 | 23 | #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" |
| @@ -34,8 +34,7 @@ · 10 unmodified lines | ||
| 34 | 34 | ** pseudo-indices |
| 35 | 35 | */ |
| 36 | 36 | #define LUA_REGISTRYINDEX LUAI_FIRSTPSEUDOIDX |
| 37 | −#define LUA_ENVIRONINDEX (LUA_REGISTRYINDEX - 1) | |
| 38 | −#define lua_upvalueindex(i) (LUA_ENVIRONINDEX - (i)) | |
| 37 | +#define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i)) | |
| 39 | 38 | |
| 40 | 39 | |
| 41 | 40 | /* thread status */ |
| @@ -82,6 +81,8 @@ typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); · 40 unmodified lines | ||
| 82 | 81 | #define LUA_TUSERDATA 7 |
| 83 | 82 | #define LUA_TTHREAD 8 |
| 84 | 83 | |
| 84 | +#define LUA_NUMTAGS 9 | |
| 85 | + | |
| 85 | 86 | |
| 86 | 87 | |
| 87 | 88 | /* minimum Lua stack available to a C function */ |
| @@ -90,8 +91,7 @@ typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); · 2 unmodified lines | ||
| 90 | 91 | |
| 91 | 92 | /* predefined values in the registry */ |
| 92 | 93 | #define LUA_RIDX_MAINTHREAD 1 |
| 93 | −#define LUA_RIDX_CPCALL 2 | |
| 94 | −#define LUA_RIDX_GLOBALS 3 | |
| 94 | +#define LUA_RIDX_GLOBALS 2 | |
| 95 | 95 | #define LUA_RIDX_LAST LUA_RIDX_GLOBALS |
| 96 | 96 | |
| 97 | 97 | |
| @@ -129,6 +129,7 @@ LUA_API const lua_Number *(lua_version) (lua_State *L); · 31 unmodified lines | ||
| 129 | 129 | /* |
| 130 | 130 | ** basic stack manipulation |
| 131 | 131 | */ |
| 132 | +LUA_API int (lua_absindex) (lua_State *L, int idx); | |
| 132 | 133 | LUA_API int (lua_gettop) (lua_State *L); |
| 133 | 134 | LUA_API void (lua_settop) (lua_State *L, int idx); |
| 134 | 135 | LUA_API void (lua_pushvalue) (lua_State *L, int idx); |
| @@ -212,7 +213,7 @@ LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n); · 77 unmodified lines | ||
| 212 | 213 | LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); |
| 213 | 214 | LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); |
| 214 | 215 | LUA_API int (lua_getmetatable) (lua_State *L, int objindex); |
| 215 | −LUA_API void (lua_getfenv) (lua_State *L, int idx); | |
| 216 | +LUA_API void (lua_getenv) (lua_State *L, int idx); | |
| 216 | 217 | |
| 217 | 218 | |
| 218 | 219 | /* |
| @@ -223,7 +224,7 @@ LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); · 4 unmodified lines | ||
| 223 | 224 | LUA_API void (lua_rawset) (lua_State *L, int idx); |
| 224 | 225 | LUA_API void (lua_rawseti) (lua_State *L, int idx, int n); |
| 225 | 226 | LUA_API int (lua_setmetatable) (lua_State *L, int objindex); |
| 226 | −LUA_API int (lua_setfenv) (lua_State *L, int idx); | |
| 227 | +LUA_API void (lua_setenv) (lua_State *L, int idx); | |
| 227 | 228 | |
| 228 | 229 | |
| 229 | 230 | /* |
| @@ -267,6 +268,8 @@ LUA_API int (lua_status) (lua_State *L); · 37 unmodified lines | ||
| 267 | 268 | #define LUA_GCSETPAUSE 6 |
| 268 | 269 | #define LUA_GCSETSTEPMUL 7 |
| 269 | 270 | #define LUA_GCISRUNNING 8 |
| 271 | +#define LUA_GCGEN 9 | |
| 272 | +#define LUA_GCINC 10 | |
| 270 | 273 | |
| 271 | 274 | LUA_API int (lua_gc) (lua_State *L, int what, int data); |
| 272 | 275 | |
| @@ -297,11 +300,14 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); · 24 unmodified lines | ||
| 297 | 300 | |
| 298 | 301 | #define lua_newtable(L) lua_createtable(L, 0, 0) |
| 299 | 302 | |
| 300 | −#define lua_setglobal(L,s) lua_setfield(L, LUA_ENVIRONINDEX, (s)) | |
| 301 | −#define lua_getglobal(L,s) lua_getfield(L, LUA_ENVIRONINDEX, (s)) | |
| 303 | +#define lua_setglobal(L,s) \ | |
| 304 | + (lua_pushglobaltable(L), lua_pushvalue(L, -2), \ | |
| 305 | + lua_setfield(L, -2, (s)), lua_pop(L, 2)) | |
| 306 | + | |
| 307 | +#define lua_getglobal(L,s) \ | |
| 308 | + (lua_pushglobaltable(L), lua_getfield(L, -1, (s)), lua_remove(L, -2)) | |
| 302 | 309 | |
| 303 | −#define lua_register(L,n,f) \ | |
| 304 | − (lua_pushcfunction(L, (f)), lua_setfield(L, LUA_ENVIRONINDEX, (n))) | |
| 310 | +#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) | |
| 305 | 311 | |
| 306 | 312 | #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) |
| 307 | 313 | |