diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-02-12 15:32:09 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-02-12 15:32:09 -0300 |
commit | afaa98a666acd5f596b50f56bb288815838c096e (patch) | |
tree | 598f2139de92947f1b29088bb40544e9c94bbb62 | |
parent | 73be918285f7e2eb0acc02d73effa6a95a8ab08c (diff) | |
download | lua-afaa98a666acd5f596b50f56bb288815838c096e.tar.gz lua-afaa98a666acd5f596b50f56bb288815838c096e.tar.bz2 lua-afaa98a666acd5f596b50f56bb288815838c096e.zip |
no more "lua_pushliteral".
-rw-r--r-- | lua.h | 7 | ||||
-rw-r--r-- | manual.tex | 13 |
2 files changed, 7 insertions, 13 deletions
@@ -2,7 +2,7 @@ | |||
2 | ** LUA - Linguagem para Usuarios de Aplicacao | 2 | ** LUA - Linguagem para Usuarios de Aplicacao |
3 | ** Grupo de Tecnologia em Computacao Grafica | 3 | ** Grupo de Tecnologia em Computacao Grafica |
4 | ** TeCGraf - PUC-Rio | 4 | ** TeCGraf - PUC-Rio |
5 | ** $Id: lua.h,v 3.20 1995/10/31 16:41:53 roberto Exp roberto $ | 5 | ** $Id: lua.h,v 3.21 1995/11/13 15:36:52 roberto Exp roberto $ |
6 | */ | 6 | */ |
7 | 7 | ||
8 | 8 | ||
@@ -60,7 +60,6 @@ void *lua_getuserdata (lua_Object object); | |||
60 | void lua_pushnil (void); | 60 | void lua_pushnil (void); |
61 | void lua_pushnumber (float n); | 61 | void lua_pushnumber (float n); |
62 | void lua_pushstring (char *s); | 62 | void lua_pushstring (char *s); |
63 | void lua_pushliteral (char *s); | ||
64 | void lua_pushcfunction (lua_CFunction fn); | 63 | void lua_pushcfunction (lua_CFunction fn); |
65 | void lua_pushusertag (void *u, int tag); | 64 | void lua_pushusertag (void *u, int tag); |
66 | void lua_pushobject (lua_Object object); | 65 | void lua_pushobject (lua_Object object); |
@@ -98,7 +97,9 @@ lua_Object lua_createtable (void); | |||
98 | #define lua_isuserdata(_) (lua_type(_)>=LUA_T_USERDATA) | 97 | #define lua_isuserdata(_) (lua_type(_)>=LUA_T_USERDATA) |
99 | 98 | ||
100 | 99 | ||
101 | /* for lua 1.1 compatibility. Avoid using these macros */ | 100 | /* for compatibility with old versions. Avoid using these macros */ |
101 | |||
102 | #define lua_pushliteral(o) lua_pushstring(o) | ||
102 | 103 | ||
103 | #define lua_getindexed(o,n) (lua_pushobject(o), lua_pushnumber(n), lua_getsubscript()) | 104 | #define lua_getindexed(o,n) (lua_pushobject(o), lua_pushnumber(n), lua_getsubscript()) |
104 | #define lua_getfield(o,f) (lua_pushobject(o), lua_pushliteral(f), lua_getsubscript()) | 105 | #define lua_getfield(o,f) (lua_pushobject(o), lua_pushliteral(f), lua_getsubscript()) |
@@ -1,4 +1,4 @@ | |||
1 | % $Id: manual.tex,v 1.8 1996/02/09 17:21:27 roberto Exp roberto $ | 1 | % $Id: manual.tex,v 1.9 1996/02/09 19:02:30 roberto Exp roberto $ |
2 | 2 | ||
3 | \documentstyle[A4,11pt,bnf]{article} | 3 | \documentstyle[A4,11pt,bnf]{article} |
4 | 4 | ||
@@ -32,7 +32,7 @@ Waldemar Celes Filho | |||
32 | Departamento de Inform\'atica --- PUC-Rio | 32 | Departamento de Inform\'atica --- PUC-Rio |
33 | } | 33 | } |
34 | 34 | ||
35 | \date{\small \verb$Date: 1996/02/09 17:21:27 $} | 35 | \date{\small \verb$Date: 1996/02/09 19:02:30 $} |
36 | 36 | ||
37 | \maketitle | 37 | \maketitle |
38 | 38 | ||
@@ -836,13 +836,12 @@ otherwise, the function returns 0 (the null pointer). | |||
836 | 836 | ||
837 | The reverse process, that is, passing a specific C value to Lua, | 837 | The reverse process, that is, passing a specific C value to Lua, |
838 | is done by using the following functions: | 838 | is done by using the following functions: |
839 | \Deffunc{lua_pushnumber}\Deffunc{lua_pushstring}\Deffunc{lua_pushliteral} | 839 | \Deffunc{lua_pushnumber}\Deffunc{lua_pushstring} |
840 | \Deffunc{lua_pushcfunction}\Deffunc{lua_pushusertag} | 840 | \Deffunc{lua_pushcfunction}\Deffunc{lua_pushusertag} |
841 | \Deffunc{lua_pushuserdata} | 841 | \Deffunc{lua_pushuserdata} |
842 | \begin{verbatim} | 842 | \begin{verbatim} |
843 | void lua_pushnumber (double n); | 843 | void lua_pushnumber (double n); |
844 | void lua_pushstring (char *s); | 844 | void lua_pushstring (char *s); |
845 | void lua_pushliteral (char *s); | ||
846 | void lua_pushcfunction (lua_CFunction f); | 845 | void lua_pushcfunction (lua_CFunction f); |
847 | void lua_pushusertag (void *u, int tag); | 846 | void lua_pushusertag (void *u, int tag); |
848 | \end{verbatim} | 847 | \end{verbatim} |
@@ -855,12 +854,6 @@ convert it to a correspondent \verb'lua_Object', | |||
855 | and leave the result on the top of the Lua stack, | 854 | and leave the result on the top of the Lua stack, |
856 | where it can be assigned to a Lua variable, | 855 | where it can be assigned to a Lua variable, |
857 | passed as paramenter to a Lua function, etc (see below). \label{pushing} | 856 | passed as paramenter to a Lua function, etc (see below). \label{pushing} |
858 | \verb'lua_pushliteral' is like \verb'lua_pushstring', | ||
859 | but also puts the string in the Lua literal table and merges duplications. | ||
860 | This avoids the string to be garbage collected, | ||
861 | and therefore has a better overall performance. | ||
862 | As a rule, when the string to be pushed is a literal, | ||
863 | \verb'lua_pushliteral' should be used. | ||
864 | 857 | ||
865 | User data can have different tags, | 858 | User data can have different tags, |
866 | whose semantics are defined by the host program. | 859 | whose semantics are defined by the host program. |