I don’t really understand what this means, from my basic knowledge I’m assuming this means I’m stacking functions (calling a function INSIDE of another function)
Am I correct, and is this bad practice that I should avoid?
I don’t really understand what this means, from my basic knowledge I’m assuming this means I’m stacking functions (calling a function INSIDE of another function)
Am I correct, and is this bad practice that I should avoid?
I read the answer to that and I just don’t understand it, Also I don’t believe it answers if it’s bad to have stacks.
When an error occurs, a stack trace is generated which basically tells you where the error originated and where it ended. Where it says “Stack Begin” under the error message, that’s just it saying that its where the trace begins.
So it’s literally only for helping debug errors, meaning if you see it you have an error?
Yes. It only appears under error messages unless you have your own erroring system (lmk me if you wanna see about that)
Edit: If you want to generate your own stack trace when an error occurs, use debug.traceback. I recommend using this in conjunction with xpcall:
local function LogError(Message: string?)
-- The level is set at 2 so this function doesn't appear in the stack trace
warn(debug.traceback(Message, 2))
end
local bool = false
xpcall(function()
if bool == false then
error("bool is false :(")
else
print("bool is true!")
end
end, LogError)
Stack trace:
ServerScriptService.Script:9: bool is false :( -- Error message
ServerScriptService.Script:9 -- The line where the error is
ServerScriptService.Script:7 -- The function containing the error
Yeah I only just now realized that it’s being called by old plugins causing errors.
Thanks for helping me understand this
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.