Browse Source

new lua_Objects are created below the C2lua stack, so most API functions
don't need to adjust stack. So lua_getref does not change the stack,
and lua_pushref can use it as a macro.

Roberto Ierusalimschy 28 năm trước cách đây
mục cha
commit
d68d8287aa
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 3 2
      lua.h

+ 3 - 2
lua.h

@@ -2,7 +2,7 @@
 ** LUA - An Extensible Extension Language
 ** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
 ** e-mail: [email protected]
-** $Id: lua.h,v 4.3 1997/04/15 16:52:20 roberto Exp roberto $
+** $Id: lua.h,v 4.4 1997/05/26 14:42:51 roberto Exp roberto $
 */
 
 
@@ -78,7 +78,6 @@ int            lua_tag			(lua_Object object);
 
 int            lua_ref			(int lock); /* In: value */
 lua_Object     lua_getref		(int ref);
-void	       lua_pushref		(int ref);
 void	       lua_unref		(int ref);
 
 lua_Object     lua_createtable		(void);
@@ -90,6 +89,8 @@ long	       lua_collectgarbage	(long limit);
 /* =============================================================== */
 /* some useful macros */
 
+#define lua_pushref(ref)	(lua_pushobject(lua_getref(ref)))
+
 #define lua_refobject(o,l)	(lua_pushobject(o), lua_ref(l))
 
 #define lua_register(n,f)	(lua_pushcfunction(f), lua_setglobal(n))