diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-08-11 11:18:10 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-08-11 11:18:10 -0300 |
commit | e2c07dcbf7492e79e5825a6ca66d28e2e372f71e (patch) | |
tree | 0bc3eb66a5710dd58f65d2747850e87f01dfba7a | |
parent | 439e45a2f69549b674d6a6e2023e8debfa00a2b8 (diff) | |
download | lua-e2c07dcbf7492e79e5825a6ca66d28e2e372f71e.tar.gz lua-e2c07dcbf7492e79e5825a6ca66d28e2e372f71e.tar.bz2 lua-e2c07dcbf7492e79e5825a6ca66d28e2e372f71e.zip |
Improved documentation for 'lua_getinfo'
-rw-r--r-- | manual/manual.of | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/manual/manual.of b/manual/manual.of index 67d3b7e1..664b5c1e 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
@@ -4685,7 +4685,10 @@ information about a function or an activation record. | |||
4685 | @Lid{lua_getstack} fills only the private part | 4685 | @Lid{lua_getstack} fills only the private part |
4686 | of this structure, for later use. | 4686 | of this structure, for later use. |
4687 | To fill the other fields of @Lid{lua_Debug} with useful information, | 4687 | To fill the other fields of @Lid{lua_Debug} with useful information, |
4688 | you must call @Lid{lua_getinfo}. | 4688 | you must call @Lid{lua_getinfo} with an appropriate parameter. |
4689 | (Specifically, to get a field, | ||
4690 | you must add the letter between parentheses in the field's comment | ||
4691 | to the parameter @id{what} of @Lid{lua_getinfo}.) | ||
4689 | 4692 | ||
4690 | The fields of @Lid{lua_Debug} have the following meaning: | 4693 | The fields of @Lid{lua_Debug} have the following meaning: |
4691 | @description{ | 4694 | @description{ |
@@ -4838,10 +4841,24 @@ printf("%d\n", ar.linedefined); | |||
4838 | 4841 | ||
4839 | Each character in the string @id{what} | 4842 | Each character in the string @id{what} |
4840 | selects some fields of the structure @id{ar} to be filled or | 4843 | selects some fields of the structure @id{ar} to be filled or |
4841 | a value to be pushed on the stack: | 4844 | a value to be pushed on the stack. |
4845 | (These characters are also documented in the declaration of | ||
4846 | the structure @Lid{lua_Debug}, | ||
4847 | between parentheses in the comments following each field.) | ||
4842 | @description{ | 4848 | @description{ |
4843 | 4849 | ||
4844 | @item{@Char{n}| fills in the field @id{name} and @id{namewhat}; | 4850 | @item{@Char{f}| |
4851 | pushes onto the stack the function that is | ||
4852 | running at the given level; | ||
4853 | } | ||
4854 | |||
4855 | @item{@Char{l}| fills in the field @id{currentline}; | ||
4856 | } | ||
4857 | |||
4858 | @item{@Char{n}| fills in the fields @id{name} and @id{namewhat}; | ||
4859 | } | ||
4860 | |||
4861 | @item{@Char{r}| fills in the fields @id{ftransfer} and @id{ntransfer}; | ||
4845 | } | 4862 | } |
4846 | 4863 | ||
4847 | @item{@Char{S}| | 4864 | @item{@Char{S}| |
@@ -4849,9 +4866,6 @@ fills in the fields @id{source}, @id{short_src}, | |||
4849 | @id{linedefined}, @id{lastlinedefined}, and @id{what}; | 4866 | @id{linedefined}, @id{lastlinedefined}, and @id{what}; |
4850 | } | 4867 | } |
4851 | 4868 | ||
4852 | @item{@Char{l}| fills in the field @id{currentline}; | ||
4853 | } | ||
4854 | |||
4855 | @item{@Char{t}| fills in the field @id{istailcall}; | 4869 | @item{@Char{t}| fills in the field @id{istailcall}; |
4856 | } | 4870 | } |
4857 | 4871 | ||
@@ -4859,21 +4873,13 @@ fills in the fields @id{source}, @id{short_src}, | |||
4859 | @id{nups}, @id{nparams}, and @id{isvararg}; | 4873 | @id{nups}, @id{nparams}, and @id{isvararg}; |
4860 | } | 4874 | } |
4861 | 4875 | ||
4862 | @item{@Char{f}| | ||
4863 | pushes onto the stack the function that is | ||
4864 | running at the given level; | ||
4865 | } | ||
4866 | |||
4867 | @item{@Char{L}| | 4876 | @item{@Char{L}| |
4868 | pushes onto the stack a table whose indices are the | 4877 | pushes onto the stack a table whose indices are |
4869 | numbers of the lines that are valid on the function. | 4878 | the lines on the function with some associated code, |
4870 | (A @emph{valid line} is a line with some associated code, | 4879 | that is, the lines where you can put a break point. |
4871 | that is, a line where you can put a break point. | 4880 | (Lines with no code include empty lines and comments.) |
4872 | Non-valid lines include empty lines and comments.) | ||
4873 | |||
4874 | If this option is given together with option @Char{f}, | 4881 | If this option is given together with option @Char{f}, |
4875 | its table is pushed after the function. | 4882 | its table is pushed after the function. |
4876 | |||
4877 | This is the only option that can raise a memory error. | 4883 | This is the only option that can raise a memory error. |
4878 | } | 4884 | } |
4879 | 4885 | ||