generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

how to make your code safer(tutorial)

Previous Thread :: Next Thread 
SorryForBumping is not online. SorryForBumping
Joined: 23 Mar 2014
Total Posts: 194
09 Mar 2015 10:25 PM
put parentheses around pretty much everything

if (5 < 3) then
print("banana");
end

local x = (true);

in tables

in dictionaries

in functions


use semicolons

because sometime in the future the semicolon god is going to take over

and require semicolons EVERYWHERE;;;;

so get a headstart

you do it:

after defining variables

local x = (true);

after a table or dictionary

local table = {(value1), (value2), (value3)};

local array = [(1), (7), (15)];

and lots of other places! post a script if you need to know where all the semicolons go
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
09 Mar 2015 10:25 PM
no
Report Abuse
SorryForBumping is not online. SorryForBumping
Joined: 23 Mar 2014
Total Posts: 194
09 Mar 2015 10:29 PM
i seriously think it is good practice to use parentheses to make code safer

because some languages require it all the time

and i think it makes sense

if(condition) then
(do stuff but do it carefully in parentheses at least partially);
end
Report Abuse
KOTwarrior is not online. KOTwarrior
Joined: 13 Jun 2012
Total Posts: 4376
09 Mar 2015 10:45 PM
i do some of this stuff already.
except the parentheses around EVERYTHING:

i only use them in these case

local a = (not b);

while (a) do
end

and

if (a) then
end


i don't remember off the top of my head where i use the thingies.
Report Abuse
LucasLua is not online. LucasLua
Joined: 18 Jun 2008
Total Posts: 7386
09 Mar 2015 10:47 PM
What makes this more "careful"? Do you mean that if there were no parenthesis the game would simply crash? I am confused...
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
09 Mar 2015 10:48 PM
He's strongly hinting (not subtly at all) that he will one day take over Roblox an enforce parentheses and semicolons upon all of us.
Report Abuse
LucasLua is not online. LucasLua
Joined: 18 Jun 2008
Total Posts: 7386
09 Mar 2015 10:59 PM
Oh. Sounds like a comma-tastraphe. Could send us to the colon-ial times. I'm too shocked to be in exclamation. He could take over by the end of first period. Have I gone too far yet? I know many of you are prone to hyphen-ventilation.
Report Abuse
KOTwarrior is not online. KOTwarrior
Joined: 13 Jun 2012
Total Posts: 4376
09 Mar 2015 11:02 PM
im only semi-worried about this; it shouldn't be too much of an exclamation.
Report Abuse
xLink123 is not online. xLink123
Joined: 07 Aug 2014
Total Posts: 11158
09 Mar 2015 11:03 PM
semicolons also go after functions
Report Abuse
SorryForBumping is not online. SorryForBumping
Joined: 23 Mar 2014
Total Posts: 194
09 Mar 2015 11:08 PM
not in lua link

but yes in other languages they do

but there is something called implied syntax, and if there isn't, i just invented it

you take the purpose of a bit of syntax, and understand it's conventions, and then figure out the most logical implementation into another area of knowledge
Report Abuse
xLink123 is not online. xLink123
Joined: 07 Aug 2014
Total Posts: 11158
09 Mar 2015 11:09 PM
yea I thought that was implied when I wrote that
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
09 Mar 2015 11:10 PM
Well each language has it's own syntax implications. Lua will implicitly convert strings to numbers when you do math on them. C# will not.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image