diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-10-31 17:40:14 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-10-31 17:40:14 -0200 |
commit | 46347d768e571ba9b36581c36d11d2de1dee2cfb (patch) | |
tree | 70818496b180f09e98693b9b2cf726bcf559076c /lua.h | |
parent | 36eb6658599f7ec158b819f259eca338ee9a0d1a (diff) | |
download | lua-46347d768e571ba9b36581c36d11d2de1dee2cfb.tar.gz lua-46347d768e571ba9b36581c36d11d2de1dee2cfb.tar.bz2 lua-46347d768e571ba9b36581c36d11d2de1dee2cfb.zip |
`ref' support goes to auxlib
Diffstat (limited to 'lua.h')
-rw-r--r-- | lua.h | 25 |
1 files changed, 15 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.104 2001/10/11 21:41:21 roberto Exp $ | 2 | ** $Id: lua.h,v 1.105 2001/10/17 21:12:57 roberto Exp $ |
3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil | 4 | ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil |
5 | ** e-mail: info@lua.org | 5 | ** e-mail: info@lua.org |
@@ -26,11 +26,6 @@ | |||
26 | #define LUA_ERRORMESSAGE "_ERRORMESSAGE" | 26 | #define LUA_ERRORMESSAGE "_ERRORMESSAGE" |
27 | 27 | ||
28 | 28 | ||
29 | /* pre-defined references */ | ||
30 | #define LUA_NOREF (-2) | ||
31 | #define LUA_REFNIL (-1) | ||
32 | |||
33 | |||
34 | /* option for multiple returns in `lua_call' */ | 29 | /* option for multiple returns in `lua_call' */ |
35 | #define LUA_MULTRET (-1) | 30 | #define LUA_MULTRET (-1) |
36 | 31 | ||
@@ -180,7 +175,6 @@ LUA_API void lua_rawset (lua_State *L, int index); | |||
180 | LUA_API void lua_rawseti (lua_State *L, int index, int n); | 175 | LUA_API void lua_rawseti (lua_State *L, int index, int n); |
181 | LUA_API void lua_setglobals (lua_State *L); | 176 | LUA_API void lua_setglobals (lua_State *L); |
182 | LUA_API void lua_settagmethod (lua_State *L, int tag, const lua_char *event); | 177 | LUA_API void lua_settagmethod (lua_State *L, int tag, const lua_char *event); |
183 | LUA_API int lua_ref (lua_State *L, int lock); | ||
184 | 178 | ||
185 | 179 | ||
186 | /* | 180 | /* |
@@ -214,8 +208,6 @@ LUA_API const lua_char *lua_tag2name (lua_State *L, int tag); | |||
214 | 208 | ||
215 | LUA_API void lua_error (lua_State *L, const lua_char *s); | 209 | LUA_API void lua_error (lua_State *L, const lua_char *s); |
216 | 210 | ||
217 | LUA_API void lua_unref (lua_State *L, int ref); | ||
218 | |||
219 | LUA_API int lua_next (lua_State *L, int index); | 211 | LUA_API int lua_next (lua_State *L, int index); |
220 | LUA_API int lua_getn (lua_State *L, int index); | 212 | LUA_API int lua_getn (lua_State *L, int index); |
221 | 213 | ||
@@ -253,7 +245,6 @@ LUA_API int lua_getweakmode (lua_State *L, int index); | |||
253 | 245 | ||
254 | #define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX); | 246 | #define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX); |
255 | 247 | ||
256 | #define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, ref) | ||
257 | 248 | ||
258 | 249 | ||
259 | /* | 250 | /* |
@@ -264,6 +255,20 @@ LUA_API int lua_getweakmode (lua_State *L, int index); | |||
264 | 255 | ||
265 | LUA_API void lua_pushupvalues (lua_State *L); | 256 | LUA_API void lua_pushupvalues (lua_State *L); |
266 | 257 | ||
258 | |||
259 | /* compatibility with ref system */ | ||
260 | |||
261 | /* pre-defined references */ | ||
262 | #define LUA_NOREF (-2) | ||
263 | #define LUA_REFNIL (-1) | ||
264 | |||
265 | #define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \ | ||
266 | (lua_error(L, l_s("unlocked references are obsolete")), 0)) | ||
267 | |||
268 | #define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref)) | ||
269 | |||
270 | #define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, ref) | ||
271 | |||
267 | #endif | 272 | #endif |
268 | 273 | ||
269 | 274 | ||