mirror of https://github.com/rusefi/lua.git
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.
This commit is contained in:
parent
e1249970c2
commit
d68d8287aa
5
lua.h
5
lua.h
|
@ -2,7 +2,7 @@
|
||||||
** LUA - An Extensible Extension Language
|
** LUA - An Extensible Extension Language
|
||||||
** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
|
** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
|
||||||
** e-mail: lua@tecgraf.puc-rio.br
|
** e-mail: lua@tecgraf.puc-rio.br
|
||||||
** $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 */
|
int lua_ref (int lock); /* In: value */
|
||||||
lua_Object lua_getref (int ref);
|
lua_Object lua_getref (int ref);
|
||||||
void lua_pushref (int ref);
|
|
||||||
void lua_unref (int ref);
|
void lua_unref (int ref);
|
||||||
|
|
||||||
lua_Object lua_createtable (void);
|
lua_Object lua_createtable (void);
|
||||||
|
@ -90,6 +89,8 @@ long lua_collectgarbage (long limit);
|
||||||
/* =============================================================== */
|
/* =============================================================== */
|
||||||
/* some useful macros */
|
/* 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_refobject(o,l) (lua_pushobject(o), lua_ref(l))
|
||||||
|
|
||||||
#define lua_register(n,f) (lua_pushcfunction(f), lua_setglobal(n))
|
#define lua_register(n,f) (lua_pushcfunction(f), lua_setglobal(n))
|
||||||
|
|
Loading…
Reference in New Issue