aboutsummaryrefslogtreecommitdiff
path: root/manual.tex
diff options
context:
space:
mode:
Diffstat (limited to 'manual.tex')
-rw-r--r--manual.tex50
1 files changed, 35 insertions, 15 deletions
diff --git a/manual.tex b/manual.tex
index 7d0494e9..80ed4504 100644
--- a/manual.tex
+++ b/manual.tex
@@ -1,4 +1,4 @@
1% $Id: manual.tex,v 1.36 2000/04/17 19:23:48 roberto Exp roberto $ 1% $Id: manual.tex,v 1.37 2000/05/12 19:19:18 roberto Exp roberto $
2 2
3\documentclass[11pt]{article} 3\documentclass[11pt]{article}
4\usepackage{fullpage,bnf} 4\usepackage{fullpage,bnf}
@@ -122,7 +122,7 @@ Waldemar Celes
122\tecgraf\ --- Computer Science Department --- PUC-Rio 122\tecgraf\ --- Computer Science Department --- PUC-Rio
123} 123}
124 124
125\date{{\small \tt\$Date: 2000/04/17 19:23:48 $ $}} 125\date{{\small \tt\$Date: 2000/05/12 19:19:18 $ $}}
126 126
127\maketitle 127\maketitle
128 128
@@ -3329,7 +3329,22 @@ selects some fields of \verb|ar| to be filled,
3329as indicated by the letter in parentheses in the definition of \verb|lua_Debug|; 3329as indicated by the letter in parentheses in the definition of \verb|lua_Debug|;
3330that is, an \verb|S| fills the fields \verb|source| and \verb|linedefined|, 3330that is, an \verb|S| fills the fields \verb|source| and \verb|linedefined|,
3331and \verb|l| fills the field \verb|currentline|, etc. 3331and \verb|l| fills the field \verb|currentline|, etc.
3332We describe each field below: 3332
3333To get information about a function that is not active (that is,
3334it is not in the stack),
3335you set the \verb|func| field of the \verb|lua_Debug| structure
3336with the function,
3337and start the \verb|what| string with the character \verb|>|.
3338For instance, to know in which line a function \verb|f| was defined,
3339you can write
3340\begin{verbatim}
3341 lua_Debug ar;
3342 ar.func = lua_getglobal(L, "f");
3343 lua_getinfo(L, ">S", &ar);
3344 printf("%d\n", ar.linedefined);
3345\end{verbatim}
3346
3347The fields of \verb|lua_Debug| have the following meaning:
3333\begin{description} 3348\begin{description}
3334 3349
3335\item[source] 3350\item[source]
@@ -3523,21 +3538,26 @@ As a general rule, if your program does not need this library,
3523do not open it. 3538do not open it.
3524 3539
3525 3540
3526\subsubsection*{\ff \T{getstack (level, [what])}}\Deffunc{getstack} 3541\subsubsection*{\ff \T{getinfo (function, [what])}}\Deffunc{getinfo}
3542
3543This function returns a table with information about a function.
3544You can give the function directly,
3545or you can give a number as the value of \verb|function|,
3546which means the function running at level \verb|function| of the stack:
3547Level 0 is the current function (\verb|getinfo| itself);
3548level 1 is the function that called \verb|getinfo|;
3549and so on.
3550If \verb|function| is a number larger than the number of active functions,
3551\verb|getinfo| returns \nil.
3527 3552
3528This function returns a table with information about the function 3553The returned table contains all the fields returned by \verb|lua_getinfo|,
3529running at level \verb|level| of the stack.
3530Level 0 is the current function (\verb|getstack| itself);
3531level 1 is the function that called \verb|getstack|.
3532If \verb|level| is larger than the number of active functions,
3533the function returns \nil.
3534The table contains all the fields returned by \verb|lua_getinfo|,
3535with the string \verb|what| describing what to get. 3554with the string \verb|what| describing what to get.
3536The default for \rerb|what| is to get all information available. 3555The default for \verb|what| is to get all information available.
3537 3556
3538For instance, the expression \verb|getstack(1,"n").name| returns 3557For instance, the expression \verb|getinfo(1,"n").name| returns
3539the name of the current function, 3558the name of the current function, if a reasonable name can be found,
3540if a reasonable name can be found. 3559and \verb|getinfo(print)| returns a table with all available information
3560about the \verb|print| function.
3541 3561
3542 3562
3543\subsubsection*{\ff \T{getlocal (level, local)}}\Deffunc{getlocal} 3563\subsubsection*{\ff \T{getlocal (level, local)}}\Deffunc{getlocal}