History

Lua 5.2.0-work3

Lua Team committed 16 years ago

Commit d618ddd1 parent be77f2777 files · +3825 −3949Browse files

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

Unified · Split

src/lua.h+18−12
@@ -1,5 +1,5 @@
11 /*
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 $
33 ** Lua - A Scripting Language
44 ** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
55 ** See Copyright Notice at the end of this file
@@ -17,7 +17,7 @@ · 11 unmodified lines
1717
1818
1919 #define LUA_VERSION "Lua 5.2"
20−#define LUA_RELEASE "Lua 5.2.0 (work2)"
20+#define LUA_RELEASE "Lua 5.2.0 (work3)"
2121 #define LUA_VERSION_NUM 502
2222 #define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2010 Lua.org, PUC-Rio"
2323 #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
@@ -34,8 +34,7 @@ · 10 unmodified lines
3434 ** pseudo-indices
3535 */
3636 #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))
3938
4039
4140 /* thread status */
@@ -82,6 +81,8 @@ typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); · 40 unmodified lines
8281 #define LUA_TUSERDATA 7
8382 #define LUA_TTHREAD 8
8483
84+#define LUA_NUMTAGS 9
85+
8586
8687
8788 /* 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
9091
9192 /* predefined values in the registry */
9293 #define LUA_RIDX_MAINTHREAD 1
93−#define LUA_RIDX_CPCALL 2
94−#define LUA_RIDX_GLOBALS 3
94+#define LUA_RIDX_GLOBALS 2
9595 #define LUA_RIDX_LAST LUA_RIDX_GLOBALS
9696
9797
@@ -129,6 +129,7 @@ LUA_API const lua_Number *(lua_version) (lua_State *L); · 31 unmodified lines
129129 /*
130130 ** basic stack manipulation
131131 */
132+LUA_API int (lua_absindex) (lua_State *L, int idx);
132133 LUA_API int (lua_gettop) (lua_State *L);
133134 LUA_API void (lua_settop) (lua_State *L, int idx);
134135 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
212213 LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);
213214 LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
214215 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);
216217
217218
218219 /*
@@ -223,7 +224,7 @@ LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); · 4 unmodified lines
223224 LUA_API void (lua_rawset) (lua_State *L, int idx);
224225 LUA_API void (lua_rawseti) (lua_State *L, int idx, int n);
225226 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);
227228
228229
229230 /*
@@ -267,6 +268,8 @@ LUA_API int (lua_status) (lua_State *L); · 37 unmodified lines
267268 #define LUA_GCSETPAUSE 6
268269 #define LUA_GCSETSTEPMUL 7
269270 #define LUA_GCISRUNNING 8
271+#define LUA_GCGEN 9
272+#define LUA_GCINC 10
270273
271274 LUA_API int (lua_gc) (lua_State *L, int what, int data);
272275
@@ -297,11 +300,14 @@ LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); · 24 unmodified lines
297300
298301 #define lua_newtable(L) lua_createtable(L, 0, 0)
299302
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))
302309
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)))
305311
306312 #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
307313

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t