lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Roberto Ierusalimschy wrote:
On Sat, Mar 04, 2006 at 10:57:17AM -0800, Chris Marrin wrote:

I am porting LuaIDE to Lua 5.1 and have found a function lua_getlineinfo() that was added to the 5.0 Lua interpreter included with that source. I see that 5.1 has a new 'L' flag passed to lua_getinfo() that appears to do the same thing or something similar. But I can't find any documentation of this flag in the released docs.

Can anyone tell me what this flag is supposed to do, or if it is documented anywhere?


Sorry; it should be in the manual:

This option pushes onto the stack a table whose indices are the numbers
of the lines that are valid on the function. (A valid line is a line
with some associated code, that is, a line where you can put a break
point.  Non-valid lines include empty lines and comments.)

Thanks. This is very similar to what LuaIDE is doing. But this only gets the line numbers for the code inside the given function. If this function contains other functions (as listed in the Proto::p array), you don't get the line numbers for those.

LuaIDE returns the line numbers doing a recursive search through the contained functions. This allows it to know which lines are valid to put breakpoints on, what the next line number is for stepping, etc.

But I was not able to find any function in Lua 5.1 which allowed access to the functions contained within a given function. Is there any way to do this in 5.1?

--
chris marrin              ,""$, "As a general rule,don't solve puzzles
chris@marrin.com        b`    $  that open portals to Hell" ,,.
        ,.`           ,b`    ,`                            , 1$'
     ,|`             mP    ,`                              :$$'     ,mm
   ,b"              b"   ,`            ,mm      m$$    ,m         ,`P$$
  m$`             ,b`  .` ,mm        ,'|$P   ,|"1$`  ,b$P       ,`  :$1
 b$`             ,$: :,`` |$$      ,`   $$` ,|` ,$$,,`"$$     .`    :$|
b$|            _m$`,:`    :$1   ,`     ,$Pm|`    `    :$$,..;"'     |$:
P$b,      _;b$$b$1"       |$$ ,`      ,$$"             ``'          $$
 ```"```'"    `"`         `""`        ""`                          ,P`