Basically I'm just wondering if it's possible for a script to find out what line of code it's on. For example, say you wanted to make a custom error handler, and have a function return (as a string value), what line of code the error was on. How would this be done? Is this even possible?
Here's what I made for my error handler so far, but it's kinda useless since it's just different ways to use the error function:
local function errorCheck(v,err)
if not v then
error("Error: "..tostring(err))
end
return true
end
print(errorCheck(nil,"the value is nil")) -- pretty much just the assert function
But instead of the script breaking, I'd want it to only return the line that the error is on, and that's it.
P.S:
LoadStringEnabled is disabled, and I don't want to use loadstring for this.
Simplified question:
How do I find the line of code a function call is on?

3 comments
I don't know any efficient methods, but you could redefine a variable at the beginning of every line equivalent to the line it's on, and print that on the error handler.
http://wiki.roblox.com/index.php?title=API:Class/ScriptContext/Error
yeah but masta, that only fires if the code has already broken. i'm trying to find a way to get the current line of where ever i'm calling the function