diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-10-31 18:31:38 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-10-31 18:31:38 -0200 |
commit | ec9d8308b43cb468261f78fc4da6bd524c347db3 (patch) | |
tree | b72ddb0e026fc5c77a56847bf71664a0d161470e | |
parent | af59848219abcab589ac174c829102ed8a2adc8d (diff) | |
download | lua-ec9d8308b43cb468261f78fc4da6bd524c347db3.tar.gz lua-ec9d8308b43cb468261f78fc4da6bd524c347db3.tar.bz2 lua-ec9d8308b43cb468261f78fc4da6bd524c347db3.zip |
global table is also pseudo-index
-rw-r--r-- | manual.tex | 17 |
1 files changed, 6 insertions, 11 deletions
@@ -1,4 +1,4 @@ | |||
1 | % $Id: manual.tex,v 1.51 2001/07/24 17:25:03 roberto Exp roberto $ | 1 | % $Id: manual.tex,v 1.53 2001/10/31 18:06:05 roberto Exp roberto $ |
2 | 2 | ||
3 | \documentclass[11pt,twoside,draft]{article} | 3 | \documentclass[11pt,twoside,draft]{article} |
4 | \usepackage{fullpage} | 4 | \usepackage{fullpage} |
@@ -138,7 +138,7 @@ Waldemar Celes | |||
138 | \tecgraf\ --- Computer Science Department --- PUC-Rio | 138 | \tecgraf\ --- Computer Science Department --- PUC-Rio |
139 | } | 139 | } |
140 | 140 | ||
141 | %\date{{\small \tt\$Date: 2001/07/24 17:25:03 $ $}} | 141 | %\date{{\small \tt\$Date: 2001/10/31 18:06:05 $ $}} |
142 | 142 | ||
143 | \maketitle | 143 | \maketitle |
144 | 144 | ||
@@ -1869,8 +1869,8 @@ any function that accepts valid indices can also be called with | |||
1869 | which represent some Lua values that are accessible to the C~code | 1869 | which represent some Lua values that are accessible to the C~code |
1870 | but are not in the stack. | 1870 | but are not in the stack. |
1871 | 1871 | ||
1872 | Pseudo-indices are used to access the registry | 1872 | Pseudo-indices are used to access the table of globals \see{globals}, |
1873 | and the upvalues of a C function \see{c-closure}. | 1873 | the registry, and the upvalues of a C function \see{c-closure}. |
1874 | 1874 | ||
1875 | \subsection{Stack Manipulation} | 1875 | \subsection{Stack Manipulation} |
1876 | The API offers the following functions for basic stack manipulation: | 1876 | The API offers the following functions for basic stack manipulation: |
@@ -2240,7 +2240,7 @@ The compiled chunk is left as a function on top of the stack. | |||
2240 | The return values are the same as those of | 2240 | The return values are the same as those of |
2241 | \verb|lua_dofile| and \verb|lua_dobuffer|. | 2241 | \verb|lua_dofile| and \verb|lua_dobuffer|. |
2242 | 2242 | ||
2243 | \subsection{Manipulating Global Variables} | 2243 | \subsection{Manipulating Global Variables} \label{globals} |
2244 | 2244 | ||
2245 | To read the value of a global Lua variable, | 2245 | To read the value of a global Lua variable, |
2246 | you call | 2246 | you call |
@@ -2275,12 +2275,7 @@ use \verb|lua_rawset| over the table of globals | |||
2275 | (see below). | 2275 | (see below). |
2276 | 2276 | ||
2277 | All global variables are kept in an ordinary Lua table. | 2277 | All global variables are kept in an ordinary Lua table. |
2278 | You can get this table calling | 2278 | This table is always at pseudo-index \IndexAPI{LUA_GLOBALSINDEX}. |
2279 | \begin{verbatim} | ||
2280 | void lua_getglobals (lua_State *L); | ||
2281 | \end{verbatim} | ||
2282 | \DefAPI{lua_getglobals} | ||
2283 | which pushes the current table of globals onto the stack. | ||
2284 | To set another table as the table of globals, | 2279 | To set another table as the table of globals, |
2285 | you call | 2280 | you call |
2286 | \begin{verbatim} | 2281 | \begin{verbatim} |