diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-01-30 10:55:10 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1996-01-30 10:55:10 -0200 |
commit | b1c02c7f00eeffbb16a87f95ab8ef83116b97bad (patch) | |
tree | f79ba5c0639112f588fc93ae8261f0784410b64f | |
parent | 84df3ac2675af018d85d26746165325475575965 (diff) | |
download | lua-b1c02c7f00eeffbb16a87f95ab8ef83116b97bad.tar.gz lua-b1c02c7f00eeffbb16a87f95ab8ef83116b97bad.tar.bz2 lua-b1c02c7f00eeffbb16a87f95ab8ef83116b97bad.zip |
new fallback "getglobal".
modifications to generate an index (not automatically yet).
-rw-r--r-- | manual.tex | 28 |
1 files changed, 20 insertions, 8 deletions
@@ -1,4 +1,4 @@ | |||
1 | % $Id: $ | 1 | % $Id: manual.tex,v 1.2 1996/01/29 17:08:23 roberto Exp roberto $ |
2 | 2 | ||
3 | \documentstyle[A4,11pt,bnf]{article} | 3 | \documentstyle[A4,11pt,bnf]{article} |
4 | 4 | ||
@@ -13,7 +13,7 @@ | |||
13 | \newcommand{\Def}[1]{{\em #1}\index{#1}} | 13 | \newcommand{\Def}[1]{{\em #1}\index{#1}} |
14 | \newcommand{\Deffunc}[1]{\index{{\tt #1}}} | 14 | \newcommand{\Deffunc}[1]{\index{{\tt #1}}} |
15 | 15 | ||
16 | 16 | %\makeindex | |
17 | 17 | ||
18 | \begin{document} | 18 | \begin{document} |
19 | 19 | ||
@@ -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{November, 1995} | 35 | \date{\small \verb$Date: 1996/01/29 17:08:23 $} |
36 | 36 | ||
37 | \maketitle | 37 | \maketitle |
38 | 38 | ||
@@ -44,8 +44,6 @@ as a configuration language for any program that needs one. | |||
44 | This document describes version 2.2 of the Lua programming language and the | 44 | This document describes version 2.2 of the Lua programming language and the |
45 | API that allows interaction between Lua programs and its host C program. | 45 | API that allows interaction between Lua programs and its host C program. |
46 | It also presents some examples of using the main features of the system. | 46 | It also presents some examples of using the main features of the system. |
47 | |||
48 | {\em Lua manual: \verb$Date$, \verb$Revision$} | ||
49 | \end{abstract} | 47 | \end{abstract} |
50 | 48 | ||
51 | \vspace{4ex} | 49 | \vspace{4ex} |
@@ -649,6 +647,12 @@ not present in a table. | |||
649 | It receives as arguments the table and the index. | 647 | It receives as arguments the table and the index. |
650 | Its return value is the final result of the indexing operation. | 648 | Its return value is the final result of the indexing operation. |
651 | The default function returns nil. | 649 | The default function returns nil. |
650 | \item[``getglobal'']\index{index getglobal} | ||
651 | called when Lua tries to retrieve the value of a global variable | ||
652 | which has a nil value (or which has not been initialized). | ||
653 | It receives as argument the name of the variable. | ||
654 | Its return value is the final result of the expression. | ||
655 | The default function returns nil. | ||
652 | \item[``gettable'']\index{gettable fallback} | 656 | \item[``gettable'']\index{gettable fallback} |
653 | called when Lua tries to index a non table value. | 657 | called when Lua tries to index a non table value. |
654 | It receives as arguments the non table value and the index. | 658 | It receives as arguments the non table value and the index. |
@@ -751,7 +755,8 @@ executes the ``file'' {\tt stdin}. | |||
751 | 755 | ||
752 | \subsection{Converting Values between C and Lua} \label{valuesCLua} | 756 | \subsection{Converting Values between C and Lua} \label{valuesCLua} |
753 | Because Lua has no static type system, | 757 | Because Lua has no static type system, |
754 | all values passed between Lua and C have type \IndexVerb{lua\_Object}, | 758 | all values passed between Lua and C have type |
759 | \verb'lua_Object'\Deffunc{lua_Object}, | ||
755 | which works like an abstract type in C that can hold any Lua value. | 760 | which works like an abstract type in C that can hold any Lua value. |
756 | 761 | ||
757 | Lua has automatic memory management, and garbage collection. | 762 | Lua has automatic memory management, and garbage collection. |
@@ -832,7 +837,8 @@ otherwise, the function returns 0 (the null pointer). | |||
832 | 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, |
833 | is done by using the following functions: | 838 | is done by using the following functions: |
834 | \Deffunc{lua_pushnumber}\Deffunc{lua_pushstring}\Deffunc{lua_pushliteral} | 839 | \Deffunc{lua_pushnumber}\Deffunc{lua_pushstring}\Deffunc{lua_pushliteral} |
835 | \Deffunc{lua_pushcfunction}\Deffunc{lua_pushusertag}\Deffunc{lua_pushuserdata} | 840 | \Deffunc{lua_pushcfunction}\Deffunc{lua_pushusertag} |
841 | \Deffunc{lua_pushuserdata} | ||
836 | \begin{verbatim} | 842 | \begin{verbatim} |
837 | void lua_pushnumber (double n); | 843 | void lua_pushnumber (double n); |
838 | void lua_pushstring (char *s); | 844 | void lua_pushstring (char *s); |
@@ -1040,7 +1046,8 @@ lua_Object lua_getparam (int number); | |||
1040 | \end{verbatim} | 1046 | \end{verbatim} |
1041 | where \verb'number' starts with 1 to get the first argument. | 1047 | where \verb'number' starts with 1 to get the first argument. |
1042 | When called with a number larger than the actual number of arguments, | 1048 | When called with a number larger than the actual number of arguments, |
1043 | this function returns \IndexVerb{LUA\_NOOBJECT}. | 1049 | this function returns |
1050 | \verb'LUA_NOOBJECT'\Deffunc{LUA_NOOBJECT}. | ||
1044 | In this way, it is possible to write functions that work with | 1051 | In this way, it is possible to write functions that work with |
1045 | a variable number of parameters. | 1052 | a variable number of parameters. |
1046 | 1053 | ||
@@ -1781,4 +1788,9 @@ Special care should be taken with macros like | |||
1781 | \verb'lua_getindexed' and \verb'lua_getfield'. | 1788 | \verb'lua_getindexed' and \verb'lua_getfield'. |
1782 | \end{itemize} | 1789 | \end{itemize} |
1783 | 1790 | ||
1791 | \newcommand{\indexentry}[2]{\item {#1} #2} | ||
1792 | \begin{theindex} | ||
1793 | \input{manual.idx} | ||
1794 | \end{theindex} | ||
1795 | |||
1784 | \end{document} | 1796 | \end{document} |