lua-users home
lua-l archive

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

Is there a way to collect the numbers of all lines in a lua file, which
have any code associated with them?

I need this for a testing tool that I'm working on. I want to show
coverage information, i.e. how much of the Lua code in a module has been
covered by the test. I use a line hook to mark the visited lines, but I
need to know the total number of lines that generated any code. Since
not only empty lines don't generate any code (a common example is a line
with just the "end" keyword in it), I can't just count the non-empty
lines of the module.