Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to get the line calling a function? [solved]

Asked by 7 years ago
Edited by M39a9am3R 7 years ago

I'm looking for errors in my scripts but I need to find Where the function is called from

Example:

function A (string)
-- print(Where the function is called from)

print(string)
end

A("Hello")

In this case, it would print something like: "Function A got called from line 7" When an error occurs, it shows where the function, if there are functions called each others, is called from.

Anybody know? Thanks.

0
When there is an error, it will show which line it threw the error. SimplyRekt 413 — 7y
0
Well here is the problem, it's not an error that I get, it's a normal running code, but I need to know where the function is called... Very hard to explain erm maquilaque 136 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

For anyone who would like to do this: I found it, you need to do:

print(debug.traceback())

Thanks for reading and tried to help anyways :)

0
put [solved] instead of [closed] XD, [closed] is used on the post being moderated. RubenKan 3615 — 7y
Ad

Answer this question