Jump to content




Comment Clearing Program


  • You cannot reply to this topic
9 replies to this topic

#1 Kryptanyte

  • Members
  • 95 posts
  • LocationNew Zealand

Posted 22 November 2013 - 12:52 AM

I don't really know a real useful reason you would want to use this, but it's there if you need it.

The title says it all, this program will clear programs of comments, however it will not clear any multi line comments Aka --[[ Comment in Here ]] (EDIT HERE), Block Comments

Program: http://pastebin.com/2hHydSQt

Again for those who prefer spoiler tags
Spoiler

Usage:

ClearC file1 file2	 -- This will clear file1 of comments and place the cleared file in file2

OR

ClearC file1		 -- This will clear file1 of comments and replace it in the same file


Also note this program does not remove cleared lines if they are emptied and there is no text before the comment, so;

function this()

	print("Some text here") -- Comment Here

	-- And Another Comment

end

Will turn into this:

function this()

	print("Some text here")



end


Post any bugs you get when using this program and if you really want me to fix the empty line thing just say, if there's enough interest then I will try and get it to work.

Edited by Kryptanyte, 22 November 2013 - 06:24 AM.


#2 rhyleymaster

  • Members
  • 186 posts
  • LocationCanada

Posted 22 November 2013 - 01:16 AM

Or we could just use backspace, or Notepad++ to remove them all. But I guess some people feel the urge to remove comments another way.

#3 Cozzimoto

  • Members
  • 221 posts
  • LocationDallas, Tx

Posted 22 November 2013 - 05:39 AM

what about block comments too.

function this()
  print("Some text here")
  --[[ Multi line comment
  For Explaining things
  ON multiple lines
  --]]

end


Edited by Cozzimoto, 22 November 2013 - 05:43 AM.


#4 Kryptanyte

  • Members
  • 95 posts
  • LocationNew Zealand

Posted 22 November 2013 - 06:23 AM

Yeah, I did say it wouldn't do them. I can add it in if you really want me to.

#5 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 22 November 2013 - 06:23 AM

I think it'd be good to add, quite a lot of people use them. While you're at it what about this block comment?

--[=[
Multi-line comment that
supports use of [[ ]] inside of it.
]=]

Edited by theoriginalbit, 30 November 2013 - 07:56 PM.


#6 Kryptanyte

  • Members
  • 95 posts
  • LocationNew Zealand

Posted 22 November 2013 - 06:26 AM

View Posttheoriginalbit, on 22 November 2013 - 06:23 AM, said:

While you're at it what about this block comment?

--[=[
Multi-line comment that
supports use of [[ ]] inside of it.
]]

Maybe I'll do the regular block comment first...

#7 DiabolusNeil

  • Members
  • 29 posts
  • LocationCalifornia, United States of America

Posted 22 November 2013 - 02:13 PM

I actually find this useful for myself. I add a lot of comments in my code for myself for developing, but I really don't want other people to see them.

EDIT: Grammatical correction.

Edited by DiabolusNeil, 22 November 2013 - 02:14 PM.


#8 D3matt

  • Members
  • 830 posts

Posted 30 November 2013 - 01:55 PM

Not wanting other people to see your comments is rather sad, tbh. Have you seen some of the comments in commercial program source code? *shudders*

#9 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 30 November 2013 - 01:58 PM

View Posttheoriginalbit, on 22 November 2013 - 06:23 AM, said:

I think it'd be good to add, quite a lot of people use them. While you're at it what about this block comment?

--[=[
Multi-line comment that
supports use of [[ ]] inside of it.
]]

That one is invalid, since the closing brackets needs to match the opening brackets.

#10 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 30 November 2013 - 07:56 PM

View PostLyqyd, on 30 November 2013 - 01:58 PM, said:

That one is invalid, since the closing brackets needs to match the opening brackets.
Whoops, I knew it didn't look right. Couldn't put my finger on it. thanks.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users