Old 06-08-2022, 02:50 PM   #1
mazegeek999
Human being with feelings
 
mazegeek999's Avatar
 
Join Date: Jan 2015
Posts: 225
Default Tracing LUA code with line numbers

Hi there,

I wrote a method that prints the trace led to a specific line. However all it does is list the functions, but I would really like to see which line numbers those functions were called, considering I often have many calls of the same function and it would take a while to brute-force check each instance of the method. Is there a way to print out the line numbers instead of just the function names?

My current code:
Code:
function debug_printStack()
  for x=2, math.huge do
    if debug.getinfo(x) == nil then
      break
      end
    print(debug.getinfo(x).name)
    end
  end
EDIT: Replacing "name" with "currentline" works. Don't know how I missed that but I'll leave it up in case anyone else finds this useful.

Last edited by mazegeek999; 06-08-2022 at 02:58 PM.
mazegeek999 is offline   Reply With Quote
Old 03-08-2024, 07:33 PM   #2
Cencyte
Human being with feelings
 
Cencyte's Avatar
 
Join Date: Jun 2023
Location: NY
Posts: 3
Default

Thank you!
__________________
Script-Aid ➕ (Donate)
Cencyte is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:14 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.