浏览代码

no more "lua_pushliteral".

Roberto Ierusalimschy 30 年之前
父节点
当前提交
afaa98a666
共有 2 个文件被更改,包括 7 次插入13 次删除
  1. 4 3
      lua.h
  2. 3 10
      manual.tex

+ 4 - 3
lua.h

@@ -2,7 +2,7 @@
 ** LUA - Linguagem para Usuarios de Aplicacao
 ** LUA - Linguagem para Usuarios de Aplicacao
 ** Grupo de Tecnologia em Computacao Grafica
 ** Grupo de Tecnologia em Computacao Grafica
 ** TeCGraf - PUC-Rio
 ** TeCGraf - PUC-Rio
-** $Id: lua.h,v 3.20 1995/10/31 16:41:53 roberto Exp roberto $
+** $Id: lua.h,v 3.21 1995/11/13 15:36:52 roberto Exp roberto $
 */
 */
 
 
 
 
@@ -60,7 +60,6 @@ void          *lua_getuserdata  	(lua_Object object);
 void 	       lua_pushnil 		(void);
 void 	       lua_pushnil 		(void);
 void           lua_pushnumber 		(float n);
 void           lua_pushnumber 		(float n);
 void           lua_pushstring 		(char *s);
 void           lua_pushstring 		(char *s);
-void           lua_pushliteral 		(char *s);
 void           lua_pushcfunction	(lua_CFunction fn);
 void           lua_pushcfunction	(lua_CFunction fn);
 void           lua_pushusertag     	(void *u, int tag);
 void           lua_pushusertag     	(void *u, int tag);
 void           lua_pushobject       	(lua_Object object);
 void           lua_pushobject       	(lua_Object object);
@@ -98,7 +97,9 @@ lua_Object     lua_createtable		(void);
 #define lua_isuserdata(_)       (lua_type(_)>=LUA_T_USERDATA)
 #define lua_isuserdata(_)       (lua_type(_)>=LUA_T_USERDATA)
 
 
 
 
-/* for lua 1.1 compatibility. Avoid using these macros */
+/* for compatibility with old versions. Avoid using these macros */
+
+#define lua_pushliteral(o)  lua_pushstring(o)
 
 
 #define lua_getindexed(o,n) (lua_pushobject(o), lua_pushnumber(n), lua_getsubscript())
 #define lua_getindexed(o,n) (lua_pushobject(o), lua_pushnumber(n), lua_getsubscript())
 #define lua_getfield(o,f)   (lua_pushobject(o), lua_pushliteral(f), lua_getsubscript())
 #define lua_getfield(o,f)   (lua_pushobject(o), lua_pushliteral(f), lua_getsubscript())

+ 3 - 10
manual.tex

@@ -1,4 +1,4 @@
-% $Id: manual.tex,v 1.8 1996/02/09 17:21:27 roberto Exp roberto $
+% $Id: manual.tex,v 1.9 1996/02/09 19:02:30 roberto Exp roberto $
 
 
 \documentstyle[A4,11pt,bnf]{article}
 \documentstyle[A4,11pt,bnf]{article}
 
 
@@ -32,7 +32,7 @@ Waldemar Celes Filho
 Departamento de Inform\'atica --- PUC-Rio
 Departamento de Inform\'atica --- PUC-Rio
 }
 }
 
 
-\date{\small \verb$Date: 1996/02/09 17:21:27 $}
+\date{\small \verb$Date: 1996/02/09 19:02:30 $}
 
 
 \maketitle
 \maketitle
 
 
@@ -836,13 +836,12 @@ otherwise, the function returns 0 (the null pointer).
 
 
 The reverse process, that is, passing a specific C value to Lua,
 The reverse process, that is, passing a specific C value to Lua,
 is done by using the following functions:
 is done by using the following functions:
-\Deffunc{lua_pushnumber}\Deffunc{lua_pushstring}\Deffunc{lua_pushliteral}
+\Deffunc{lua_pushnumber}\Deffunc{lua_pushstring}
 \Deffunc{lua_pushcfunction}\Deffunc{lua_pushusertag}
 \Deffunc{lua_pushcfunction}\Deffunc{lua_pushusertag}
 \Deffunc{lua_pushuserdata}
 \Deffunc{lua_pushuserdata}
 \begin{verbatim}
 \begin{verbatim}
 void           lua_pushnumber           (double n);
 void           lua_pushnumber           (double n);
 void           lua_pushstring           (char *s);
 void           lua_pushstring           (char *s);
-void           lua_pushliteral          (char *s);
 void           lua_pushcfunction        (lua_CFunction f);
 void           lua_pushcfunction        (lua_CFunction f);
 void           lua_pushusertag          (void *u, int tag);
 void           lua_pushusertag          (void *u, int tag);
 \end{verbatim}
 \end{verbatim}
@@ -855,12 +854,6 @@ convert it to a correspondent \verb'lua_Object',
 and leave the result on the top of the Lua stack,
 and leave the result on the top of the Lua stack,
 where it can be assigned to a Lua variable,
 where it can be assigned to a Lua variable,
 passed as paramenter to a Lua function, etc (see below). \label{pushing}
 passed as paramenter to a Lua function, etc (see below). \label{pushing}
-\verb'lua_pushliteral' is like \verb'lua_pushstring',
-but also puts the string in the Lua literal table and merges duplications.
-This avoids the string to be garbage collected,
-and therefore has a better overall performance.
-As a rule, when the string to be pushed is a literal,
-\verb'lua_pushliteral' should be used.
 
 
 User data can have different tags,
 User data can have different tags,
 whose semantics are defined by the host program.
 whose semantics are defined by the host program.