diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-17 10:18:01 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-17 10:18:01 -0300 |
commit | 90fb2e18e84075972d1937a6c0a3c2624756a3db (patch) | |
tree | 78972c91056663b7532c2e2a1182ee95654e3d34 /lua.h | |
parent | 4365c31c89666bae24afd800ac3251527d9dc9c8 (diff) | |
download | lua-90fb2e18e84075972d1937a6c0a3c2624756a3db.tar.gz lua-90fb2e18e84075972d1937a6c0a3c2624756a3db.tar.bz2 lua-90fb2e18e84075972d1937a6c0a3c2624756a3db.zip |
`pushref' is more efficient (and probably more useful) than `getref'.
Diffstat (limited to 'lua.h')
-rw-r--r-- | lua.h | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.57 2000/08/09 19:16:57 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.58 2000/08/14 19:10:14 roberto Exp roberto $ |
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: lua@tecgraf.puc-rio.br | 5 | ** e-mail: lua@tecgraf.puc-rio.br |
@@ -122,7 +122,7 @@ int lua_next (lua_State *L, lua_Object o, int i); | |||
122 | /* Out: index, value */ | 122 | /* Out: index, value */ |
123 | 123 | ||
124 | int lua_ref (lua_State *L, int lock); /* In: value */ | 124 | int lua_ref (lua_State *L, int lock); /* In: value */ |
125 | lua_Object lua_getref (lua_State *L, int ref); | 125 | int lua_pushref (lua_State *L, int ref); /* Out: value */ |
126 | void lua_unref (lua_State *L, int ref); | 126 | void lua_unref (lua_State *L, int ref); |
127 | 127 | ||
128 | lua_Object lua_createtable (lua_State *L); | 128 | lua_Object lua_createtable (lua_State *L); |
@@ -140,7 +140,7 @@ long lua_collectgarbage (lua_State *L, long limit); | |||
140 | #ifndef LUA_SINGLESTATE | 140 | #ifndef LUA_SINGLESTATE |
141 | 141 | ||
142 | #define lua_call(L,name) lua_callfunction(L, lua_getglobal(L, name)) | 142 | #define lua_call(L,name) lua_callfunction(L, lua_getglobal(L, name)) |
143 | #define lua_pushref(L,ref) lua_pushobject(L, lua_getref(L, ref)) | 143 | #define lua_getref(L, ref) (lua_pushref(L, ref) ? lua_pop(L) : LUA_NOOBJECT) |
144 | #define lua_refobject(L,o,l) (lua_pushobject(L, o), lua_ref(L, l)) | 144 | #define lua_refobject(L,o,l) (lua_pushobject(L, o), lua_ref(L, l)) |
145 | #define lua_register(L,n,f) (lua_pushcfunction(L, f), lua_setglobal(L, n)) | 145 | #define lua_register(L,n,f) (lua_pushcfunction(L, f), lua_setglobal(L, n)) |
146 | #define lua_pushuserdata(L,u) lua_pushusertag(L, u, 0) | 146 | #define lua_pushuserdata(L,u) lua_pushusertag(L, u, 0) |
@@ -150,7 +150,7 @@ long lua_collectgarbage (lua_State *L, long limit); | |||
150 | #else | 150 | #else |
151 | 151 | ||
152 | #define lua_call(name) lua_callfunction(lua_getglobal(name)) | 152 | #define lua_call(name) lua_callfunction(lua_getglobal(name)) |
153 | #define lua_pushref(ref) lua_pushobject(lua_getref(ref)) | 153 | #define lua_getref(ref) (lua_pushref(ref) ? lua_pop() : LUA_NOOBJECT) |
154 | #define lua_refobject(o,l) (lua_pushobject(o), lua_ref(l)) | 154 | #define lua_refobject(o,l) (lua_pushobject(o), lua_ref(l)) |
155 | #define lua_register(n,f) (lua_pushcfunction(f), lua_setglobal(n)) | 155 | #define lua_register(n,f) (lua_pushcfunction(f), lua_setglobal(n)) |
156 | #define lua_pushuserdata(u) lua_pushusertag(u, 0) | 156 | #define lua_pushuserdata(u) lua_pushusertag(u, 0) |
@@ -219,7 +219,7 @@ extern lua_State *lua_state; | |||
219 | #define lua_tag(obj) (lua_tag)(lua_state, obj) | 219 | #define lua_tag(obj) (lua_tag)(lua_state, obj) |
220 | #define lua_next(o,i) (lua_next)(lua_state, o,i) | 220 | #define lua_next(o,i) (lua_next)(lua_state, o,i) |
221 | #define lua_ref(lock) (lua_ref)(lua_state, lock) | 221 | #define lua_ref(lock) (lua_ref)(lua_state, lock) |
222 | #define lua_getref(ref) (lua_getref)(lua_state, ref) | 222 | #define lua_pushref(ref) (lua_pushref)(lua_state, ref) |
223 | #define lua_unref(ref) (lua_unref)(lua_state, ref) | 223 | #define lua_unref(ref) (lua_unref)(lua_state, ref) |
224 | #define lua_createtable() (lua_createtable)(lua_state) | 224 | #define lua_createtable() (lua_createtable)(lua_state) |
225 | #define lua_collectgarbage(limit) (lua_collectgarbage)(lua_state, limit) | 225 | #define lua_collectgarbage(limit) (lua_collectgarbage)(lua_state, limit) |