User:SoulStealer9875/How to Script/Page3: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>SoulStealer9875
Created page with "== Introduction == In this page we will learn of commentary. This allows you to make notes in your script so you know what each line of code does, or to help you continue whe..."
 
>SoulStealer9875
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== Introduction ==
== Introduction ==


In this page we will learn of commentary. This allows you to make notes in your script so you know what each line of code does, or to help you continue where you left off if you take a break.
In this page we will learn of commentary. This allows you to make comments in your script so you know what each line of code does, or to help you continue where you left off if you take a break.


== One-line notes ==
== One-line comments ==
You can make notes on one line by using two hiphens. You know you are making a comment when the text after the two hiphens turns green. Make sure when making comments it is after a line of code, and not before, otherwise the line of code will be recognized as a comment, and not a line of code.
You can make comments on one line by using two hiphens. You know you are making a comment when the text after the two hiphens turns green. Make sure when making comments it is after a line of code, and not before, otherwise the line of code will be recognized as a comment, and not a line of code.


Example:
Example:


  part = Workspace.Part <font color="green">-- Locates Part in Workspace</font>
  {{lua|=part = Workspace.Part -- Locates Part in Workspace
  part.Transparency = 1 <font color="green">-- Makes Part in Workspace invisible</font>
  part.Transparency = 1 -- Makes Part in Workspace invisible}}


== Multi-line notes ==
== Multi-line comments ==
Instead of having to use two hiphens for just one line, you can do multi line notes. By using the two hiphens followed by two square brackets ''[[''
Instead of having to use two hiphens for just one line, you can do multi line comments. By using the two hiphens followed by two square brackets ''[[''


Make sure that at the end of your multi-line notes you close off your two square brackets, so the compiler knows when you are done commenting and when the code begins.
Make sure that at the end of your multi-line comments you close off your two square brackets, so the compiler knows when you are done commenting and when the code begins.


Example:
Example:


  <font color="green">--[[
  {{lua|=--[[
  These are multi line comments
  These are multi line comments
  after the notes I locate Part in Workspace with a variable
  after the comments I locate Part in Workspace with a variable
  and set its transparency to 1, invisible.
  and set its transparency to 1, invisible.
  ]]</font>
  ]]
  part = Workspace.Part <font color="green">-- Locates Part in Workspace</font>
  part = Workspace.Part -- Locates Part in Workspace
  part.Transparency = 1 <font color="green">-- Makes Part in Workspace invisible</font>
  part.Transparency = 1 -- Makes Part in Workspace invisible}}




[[User:SoulStealer9875/How_to_Script/Page2|<- Previous Page]] | [[User:SoulStealer9875/How_to_Script/Page4|Next Page ->]]
[[User:SoulStealer9875/How_to_Script/Page2|<- Previous Page]] | [[User:SoulStealer9875/How_to_Script/Page4|Next Page ->]]
{{User:SoulStealer9875/UnfinishedTemplate}}

Latest revision as of 14:47, 29 April 2012

Introduction

In this page we will learn of commentary. This allows you to make comments in your script so you know what each line of code does, or to help you continue where you left off if you take a break.

One-line comments

You can make comments on one line by using two hiphens. You know you are making a comment when the text after the two hiphens turns green. Make sure when making comments it is after a line of code, and not before, otherwise the line of code will be recognized as a comment, and not a line of code.

Example:

part = Workspace.Part -- Locates Part in Workspace
 part.Transparency = 1 -- Makes Part in Workspace invisible

Multi-line comments

Instead of having to use two hiphens for just one line, you can do multi line comments. By using the two hiphens followed by two square brackets [[

Make sure that at the end of your multi-line comments you close off your two square brackets, so the compiler knows when you are done commenting and when the code begins.

Example:

--[[
 These are multi line comments
 after the comments I locate Part in Workspace with a variable
 and set its transparency to 1, invisible.
 ]]
 part = Workspace.Part -- Locates Part in Workspace
 part.Transparency = 1 -- Makes Part in Workspace invisible


<- Previous Page | Next Page ->