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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: what is con-

Previous Thread :: Next Thread 
OriginOfKnowledge is not online. OriginOfKnowledge
Joined: 29 Nov 2014
Total Posts: 113
05 Jul 2016 03:29 AM
What is considered 'clean' code

any examples?

also, what is considered unclean code :u
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
05 Jul 2016 03:35 AM
not using a bunch of waits and using a single for loop

not writing out the same thing 1million times instead of a simple variable definition

using non-deprecated methods


Add 13,000 posts
Report Abuse
RegularTetragon is not online. RegularTetragon
Joined: 10 Oct 2009
Total Posts: 3085
05 Jul 2016 03:37 AM
clean is tabbed and commented with descriptive variable names that follow a reasonable patten. Roblox lua's casing seems to be CamelCase for objects and properties, lowerCase for variables.
Report Abuse
Siarius is not online. Siarius
Joined: 01 Apr 2012
Total Posts: 197
05 Jul 2016 03:38 AM
Clean code:

function herro(am)

if not am == "asian" then

print(1 - 1)
end

end


unclean code:

for i,v in pairs(game.Players:GetPlayers()) do
if not v:WaitForChild("Asian").Value == true then
print(1-1)
end
end


so basically clean code is whitespace, and tabbed, so it is easier to read.
unclean code is where it id all compact and hard to read.

if this is what u meant by clean and unclean code.
Report Abuse
cntkillme1 is not online. cntkillme1
Joined: 16 Feb 2012
Total Posts: 592
05 Jul 2016 03:39 AM
good troll
Report Abuse
Siarius is not online. Siarius
Joined: 01 Apr 2012
Total Posts: 197
05 Jul 2016 03:39 AM
@OP, reg is also right, he included capitialization for stuff.
Report Abuse
Lord_Narwhal is not online. Lord_Narwhal
Joined: 05 May 2012
Total Posts: 3242
05 Jul 2016 03:39 AM
"good troll"

who


Add 13,000 posts
Report Abuse
cntkillme1 is not online. cntkillme1
Joined: 16 Feb 2012
Total Posts: 592
05 Jul 2016 03:40 AM
siarus over-exaggerated the whitespace
Report Abuse
Siarius is not online. Siarius
Joined: 01 Apr 2012
Total Posts: 197
05 Jul 2016 03:40 AM
@cnt, not a troll, just wrote first things that came to my mind.
Report Abuse
ElectroTM is not online. ElectroTM
Joined: 23 Nov 2012
Total Posts: 1135
05 Jul 2016 03:40 AM
using functions to make everything understandable is a good way to keep your code clean.

ex:
local function startRound()
--Stuff
end
local function spawnPlayer(plr)
--Stuff
end
local function spawnAllPlayers()
for i,v in pairs(game.Players:GetPlayers())do
spawnPlayer(v)
end
end
remoteEvent.OnServerEvent:connect(function()
spawn(function()
startRound()
spawnAllPlayers()
end)
end)


y-you too...
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