I have this function that parses an error message, but when it’s called it doesn’t halt the thread or print an error message.
function Report(Line: number, Where: string, Message: string)
--<< Put this here to check if the function was being run, and with the correct params.
print("\n[line " .. Line .. "] Error" .. Where .. ": " .. Message)
-- >>
error("\n[line " .. Line .. "] Error" .. Where .. ": " .. Message)
end
It runs the print function, but the error function never happens, no red text shows up, and the thread continues running.
This had been working, and then randomly stopped without me changing anything.
If you want line numbers, consider using debug.info instead.
function Report(Where: string, Message: string)
local Line = debug.info(2,"l") -- 2 represents what line Report was called from, l represents line number
print("\n[line " .. Line .. "] Error" .. Where .. ": " .. Message)
end
If I call Report from line 10, it will print line 10. Notice that I removed the line argument from your function call and replaced it with debug.info.