diff options
Diffstat (limited to '')
| -rw-r--r-- | src/MoonP/stacktraceplus.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/MoonP/stacktraceplus.h b/src/MoonP/stacktraceplus.h index fcd887a..ea53885 100644 --- a/src/MoonP/stacktraceplus.h +++ b/src/MoonP/stacktraceplus.h | |||
| @@ -334,16 +334,17 @@ local function getMoonLineNumber(fname, line) | |||
| 334 | end | 334 | end |
| 335 | end | 335 | end |
| 336 | if source then | 336 | if source then |
| 337 | local i, target = 1, tonumber(line) | 337 | local current, target = 1, tonumber(line) |
| 338 | local findLine = line | ||
| 338 | for lineCode in source:gmatch("([^\n]*)\n") do | 339 | for lineCode in source:gmatch("([^\n]*)\n") do |
| 339 | if i == target then | 340 | local num = lineCode:match("--%s*(%d+)%s*$") |
| 340 | local num = lineCode:match("--%s*(%d*)%s*$") | 341 | if num then |
| 341 | if num then | 342 | findLine = num |
| 342 | return fname, num | 343 | end |
| 343 | end | 344 | if current == target then |
| 344 | break | 345 | return fname, findLine or line |
| 345 | end | 346 | end |
| 346 | i = i + 1 | 347 | current = current + 1 |
| 347 | end | 348 | end |
| 348 | end | 349 | end |
| 349 | return fname, line | 350 | return fname, line |
