Limiting/changing the call stack text shown from error()

I’m looking for a way to hide/limit what is outputted through the error function; in other words, I do not want to reveal which function called the error function. I’ve tried modifying the function levels, but this does not work - I’m pretty sure the level only shows the level of detail in the error message itself, if not i don’t know what’s happening, since no matter the level I put in I get the same call stack text (blue text).

I’ve found a method which uses xpcall and string.gsub, but this only returns a value usable with print - trying to error with it shows a new callstack.

If anyone has any ideas on how I could do this I would appreciate it. I’m not quite sure how to go about it.

1 Like

Hello @12345koip,

If you would like to hide the stacktrace generated with the error. Just disable Information in your output window.

Here is a screenshot of where the option is located.


Yes you are correct, as stated in the documentation: Lua Globals | Documentation - Roblox Creator Hub



Hope this resolves your issue.

Hey, thanks for the reply, but the idea is it should also limit the call stack which is shown from error() in the Roblox game client, so as to limit what is shown in the Developer Console. I appreciate the method to hide it in Studio though, I didn’t know that.

I believe that it is not a possibility currently in Roblox Studio, to be able to set a depth for trace stacks. Sorry.