Is there a way to disable all call to print to the output in a script?

Making a plugin it’s kinda annoying that I have to manually delete every instance of “print()” I used when I was debugging. What’s the easiest way of handling this? I was thinking there being some kinda module.

I doubt there’s a plug-in that does that, and even if it does exists, it may end up deleting certain print statements that are crucial even if it’s not under debugging.

I was thinking of a module with a customized print function that will be disabled when called under certain conditions.

Well sadly, I don’t find any plugins that does that.

Want me to quickly write up a script for this?

I’m not talking about plug ins, I’m talking about modules that you can require which gives functions that only prints things based on the conditions you give it. It’s basically a module with a custom print statement.

Actually, if you press Ctrl+H, then replace print(with --print(, it should do the same thing

That’s not really ideal if you have many module scripts, you still have to manually go through each script to do it.

Try this then:

Press CTRL + Shift + F to open Search all. Then when the menu appears, click the down arrow
image

This will open the replace menu. Then just put print( in the Find part, and --print( in the Replace section!
@guestnot99

if you want really a plugin- save this as plugin

--by commitblue
local button = plugin:CreateToolbar("rep")
local actualbutton = button:CreateButton("replace all print in a script","ye","")
actualbutton.Click:Connect(function()
for _,v in pairs(game.Selection:Get()) do
if v:IsA("LuaSourceContainer") then
v.Source = string.gsub(v.Source,"print","--print")
end
end
end)
local secbuton = button:CreateButton("replace all disabled prints in a script","ok","")
secbutton.Click:Connect(function()
for _,v in pairs(game.Selection:Get()) do
if v:IsA("LuaSourceContainer") then
v.Source = string.gsub(v.Source,"--print","print")
end
end
end)

Not sure If it works 100%

Just check if the game Id is the place where the plug-in is being tested on. You would check for the game I’d every time you print, or predefined a custom print function at the start of the script (that checks for game Id then prints).

You can actually debug plugins now.