Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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.

2 comments

0

When there is an error, it will show which line it threw the error.

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

1 answer

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 :)

1 comment

0

put [solved] instead of [closed] XD, [closed] is used on the post being moderated.

This discussion is preserved as it was. New answers, comments, and votes are closed.