lua-users home
lua-l archive

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


 > > Is there any way to enumerate all statements (or even all line numbers)
 > > in all Lua functions?
 > 
 > Use 'L' in debug.getinfo. The 'activelines' field in the debug info
 > table is a table whose keys are the lines that contain statements.
 > Here is an example:
 > 
 >  f=loadfile"test.lua"
 >  a=debug.getinfo(f,"L")
 >  for k in pairs(a.activelines) do print(k) end

Ah, nice.  Not in the manual, I notice :-)

N