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 | ** 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 |
| @@ -17,7 +17,7 @@ · 11 unmodified lines | |||
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | #define LUA_VERSION "Lua 5.2" | 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 | #define LUA_VERSION_NUM 502 | 21 | #define LUA_VERSION_NUM 502 |
| 22 | #define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2010 Lua.org, PUC-Rio" | 22 | #define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2010 Lua.org, PUC-Rio" |
| 23 | #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" | 23 | #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" |
| @@ -34,8 +34,7 @@ · 10 unmodified lines | |||
| 34 | ** pseudo-indices | 34 | ** pseudo-indices |
| 35 | */ | 35 | */ |
| 36 | #define LUA_REGISTRYINDEX LUAI_FIRSTPSEUDOIDX | 36 | #define LUA_REGISTRYINDEX LUAI_FIRSTPSEUDOIDX |
| 37 | #define LUA_ENVIRONINDEX (LUA_REGISTRYINDEX - 1) | 37 | #define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i)) |
| 38 | #define lua_upvalueindex(i) (LUA_ENVIRONINDEX - (i)) | ||
| 39 | 38 | ||
| 40 | 39 | ||
| 41 | /* thread status */ | 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 | #define LUA_TUSERDATA 7 | 81 | #define LUA_TUSERDATA 7 |
| 83 | #define LUA_TTHREAD 8 | 82 | #define LUA_TTHREAD 8 |
| 84 | 83 | ||
| 84 | #define LUA_NUMTAGS 9 | ||
| 85 | |||
| 85 | 86 | ||
| 86 | 87 | ||
| 87 | /* minimum Lua stack available to a C function */ | 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 | /* predefined values in the registry */ | 92 | /* predefined values in the registry */ |
| 92 | #define LUA_RIDX_MAINTHREAD 1 | 93 | #define LUA_RIDX_MAINTHREAD 1 |
| 93 | #define LUA_RIDX_CPCALL 2 | 94 | #define LUA_RIDX_GLOBALS 2 |
| 94 | #define LUA_RIDX_GLOBALS 3 | ||
| 95 | #define LUA_RIDX_LAST LUA_RIDX_GLOBALS | 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 | ** basic stack manipulation | 130 | ** basic stack manipulation |
| 131 | */ | 131 | */ |
| 132 | LUA_API int (lua_absindex) (lua_State *L, int idx); | ||
| 132 | LUA_API int (lua_gettop) (lua_State *L); | 133 | LUA_API int (lua_gettop) (lua_State *L); |
| 133 | LUA_API void (lua_settop) (lua_State *L, int idx); | 134 | LUA_API void (lua_settop) (lua_State *L, int idx); |
| 134 | LUA_API void (lua_pushvalue) (lua_State *L, int idx); | 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 | LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); | 213 | LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); |
| 213 | LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); | 214 | LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); |
| 214 | LUA_API int (lua_getmetatable) (lua_State *L, int objindex); | 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 | LUA_API void (lua_rawset) (lua_State *L, int idx); | 224 | LUA_API void (lua_rawset) (lua_State *L, int idx); |
| 224 | LUA_API void (lua_rawseti) (lua_State *L, int idx, int n); | 225 | LUA_API void (lua_rawseti) (lua_State *L, int idx, int n); |
| 225 | LUA_API int (lua_setmetatable) (lua_State *L, int objindex); | 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 | #define LUA_GCSETPAUSE 6 | 268 | #define LUA_GCSETPAUSE 6 |
| 268 | #define LUA_GCSETSTEPMUL 7 | 269 | #define LUA_GCSETSTEPMUL 7 |
| 269 | #define LUA_GCISRUNNING 8 | 270 | #define LUA_GCISRUNNING 8 |
| 271 | #define LUA_GCGEN 9 | ||
| 272 | #define LUA_GCINC 10 | ||
| 270 | 273 | ||
| 271 | LUA_API int (lua_gc) (lua_State *L, int what, int data); | 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 | #define lua_newtable(L) lua_createtable(L, 0, 0) | 301 | #define lua_newtable(L) lua_createtable(L, 0, 0) |
| 299 | 302 | ||
| 300 | #define lua_setglobal(L,s) lua_setfield(L, LUA_ENVIRONINDEX, (s)) | 303 | #define lua_setglobal(L,s) \ |
| 301 | #define lua_getglobal(L,s) lua_getfield(L, LUA_ENVIRONINDEX, (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) \ | 310 | #define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) |
| 304 | (lua_pushcfunction(L, (f)), lua_setfield(L, LUA_ENVIRONINDEX, (n))) | ||
| 305 | 311 | ||
| 306 | #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) | 312 | #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) |
| 307 | 313 | ||