Alpha Blue Community: Lua: Mulit-line comments - Alpha Blue Community

Jump to content

Welcome to Alpha Blue Community

Welcome to Alpha Blue Community, like most online communities you must register to view or post in our community, but don't worry this is a simple free process that requires minimal information. Take advantage of it immediately, Register Now or Sign In.

  • Start new topics and reply to others
  • Subscribe to topics and forums to get automatic updates
  • See less Adverts when you join Alpha blue's Alliance Modding group
  • Get your own Alpha Blue profile and become recognised for your skills
  • Join the Alliance and you will be able to access hidden area's of the site.
  • This enable's you to have access to resources from the group while in return you can contribute back
  • Got a Mod ? we can host a thread for your mod. Dedicated forums and private staff area's that are password protected.
Guest Message © 2010 DevFuse
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Lua: Mulit-line comments Rate Topic: -----

#1 User is offline   Jesus7Freak Icon

  • Alpha blue Master
  • PipPipPipPipPip
  • Group: Alpha Blue Masters
  • Posts: 99
  • Joined: 10-January 09
  • Gender:Male
  • Location:classified

Posted 23 July 2010 - 02:52 PM

Similiar to the
--single line comment here


--[[this is a 
multi line 
comment in Lua--]]

0

#2 User is offline   ShadowCrow Icon

  • Jedi Master
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Alpha Blue Knights
  • Posts: 380
  • Joined: 27-November 09
  • Gender:Male
  • Location:USA
  • Interests:Time

Posted 24 July 2010 - 01:08 AM

Does this also work as an in-line comment?

For e.g.
--[[does this work as a in-line comment in Lua?--]] function ....

Shadows of the Empire

Sidious Invader: "Soon I'll be ready to immerse myself in the dark side of modding, and rule the modding community with an iron fist. I leave now cackling with hate soaked delight..... "

"I am wrought with such hearty guffaws that, in addition to rolling to and fro on the floor, my posterior has separated itself from my body." ~ Ye olde ROFLMAO.
0

#3 User is offline   Commander Cody Icon

  • Force Sensitive
  • PipPipPip
  • Group: Members
  • Posts: 44
  • Joined: 17-August 09
  • Gender:Male
  • Location:Germany

Posted 24 July 2010 - 09:02 AM

Actually, this is enough:
--[[ your 
comment 
]]

You don't need the -- at the end.

@ShadowCrow: Yes, but why the extra effort? ;)
Event Coder of the SGMG
0

#4 User is offline   ShadowCrow Icon

  • Jedi Master
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Alpha Blue Knights
  • Posts: 380
  • Joined: 27-November 09
  • Gender:Male
  • Location:USA
  • Interests:Time

Posted 24 July 2010 - 01:46 PM

Personally, I think it's easier to read by using -- in front of every line, but I'm no expert. :P
Shadows of the Empire

Sidious Invader: "Soon I'll be ready to immerse myself in the dark side of modding, and rule the modding community with an iron fist. I leave now cackling with hate soaked delight..... "

"I am wrought with such hearty guffaws that, in addition to rolling to and fro on the floor, my posterior has separated itself from my body." ~ Ye olde ROFLMAO.
0

#5 User is offline   Jesus7Freak Icon

  • Alpha blue Master
  • PipPipPipPipPip
  • Group: Alpha Blue Masters
  • Posts: 99
  • Joined: 10-January 09
  • Gender:Male
  • Location:classified

Posted 24 July 2010 - 02:15 PM

View PostCommander Cody, on 24 July 2010 - 07:02 AM, said:

Actually, this is enough:
--[[ your 
comment 
]]

You don't need the -- at the end.

@ShadowCrow: Yes, but why the extra effort? ;)


Your right, I read up on it on the web, and heres why they do it this way: http://www.lua.org/pil/1.3.html

Quote

A comment starts anywhere with a double hyphen (--) and runs until the end of the line. Lua also offers block comments, which start with --[[ and run until the corresponding ]]. A common trick, when we want to comment out a piece of code, is to write the following:

--[[
print(10) -- no action (comment)
--]]

Now, if we add a single hyphen to the first line, the code is in again:
---[[
print(10) --> 10
--]]

In the first example, the -- in the last line is still inside the block comment. In the second example, the sequence ---[[ does not start a block comment; so, the print is outside comments. In this case, the last line becomes an independent comment, as it starts with --.


Some editors, such as notepad++, let you fold/collapse it.

btw the title was suppose to be "multi-line", just reporting a spell fail to who ever wants to change it.
0

#6 User is offline   Commander Cody Icon

  • Force Sensitive
  • PipPipPip
  • Group: Members
  • Posts: 44
  • Joined: 17-August 09
  • Gender:Male
  • Location:Germany

Posted 24 July 2010 - 04:15 PM

Oh, all right. I never thought of that. But to be honest I don't see much use in that because I always delete old comment junk as soon as possible anyway ^^
Event Coder of the SGMG
0

#7 User is offline   ShadowCrow Icon

  • Jedi Master
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • Group: Alpha Blue Knights
  • Posts: 380
  • Joined: 27-November 09
  • Gender:Male
  • Location:USA
  • Interests:Time

Posted 25 July 2010 - 12:41 PM

View PostJesus7Freak, on 24 July 2010 - 02:15 PM, said:

btw the title was suppose to be "multi-line", just reporting a spell fail to who ever wants to change it.


I didn't even notice till you said something. :P
Shadows of the Empire

Sidious Invader: "Soon I'll be ready to immerse myself in the dark side of modding, and rule the modding community with an iron fist. I leave now cackling with hate soaked delight..... "

"I am wrought with such hearty guffaws that, in addition to rolling to and fro on the floor, my posterior has separated itself from my body." ~ Ye olde ROFLMAO.
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users