Add Comments to Blox
This may be a stupid question, but how to I add comments to the Blox editor?
// and /* */ both seem to work as I edit the script. However, after hitting "Apply" and returning to the editor my comments disappear.
Some of our scripts get really long and comments would be helpful.
Thanks,
Garrett Wolfe
Posted 2 years ago·Last reply 2 years ago
4 comments
Jeremy Friedel
·2 years ago · EditedHi gwolfe,
In testing in the Blox editor, using opening and terminating comment syntax (/* */) worked without issue:
Unfortunately, what was not saved by Blox was starting a new line in the script parameter in the Blox template, which was not accepted as valid by Blox, and all changes after using a new line character were lost.
For a more readable script editor UI, using the native Script Editor UI and widget events, are preferred, in the script editor there is no limitation on formatting of the script or how many lines the script uses.
Alternatively, the code can be edited in a text editor/IDE with new lines present for readability, and when finished pasted in a single line when finished. Using the opening and terminating comment syntax (/* */) will work for comments.
Garrett Wolfe
OP2 years agoThanks JeremyFriedel , although it's not the answer I was looking for, you did answer my question. We are looking to add comments as new lines. Some of our blox widgets can have hundreds of lines of code. We will go with the text editor approach.
Garrett Wolfe
OP2 years agoThanks DRay I am talking about the editor specific to Blox. I understand that it shows the last valid template. The question is how do I add comments? They look to be valid, but disappear after saving.
DRay
·2 years agoHi gwolfe,
Thank you for your question.
Are you referring to the template editor specific to Blox and not the script editor, which is the same for all widgets?
The template on reload will show the last valid Blox template that didn’t return an invalid template error when saving. If the Blox template has an error all unsaved changes are lost, so it is a good idea to click accept often to limit the potential for this type of loss of progress.