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 » Scripting Helpers
Home Search
 

Re: Variables...

Previous Thread :: Next Thread 
AetherShotgun is not online. AetherShotgun
Joined: 17 Mar 2014
Total Posts: 656
03 Apr 2014 11:54 AM
I was wondering, how do other people name variables without it being confusing? If I can find a way to do it would be very nice.
Report Abuse
meSmashsta is not online. meSmashsta
Joined: 31 Jan 2013
Total Posts: 1002
03 Apr 2014 11:55 AM
put a comment to remind yourself what it does.

fapMode = false -- note to self: used to etc etc
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
03 Apr 2014 11:56 AM
http://wiki.roblox.com/index.php?title=Writing_Clean_Code
http://wiki.roblox.com/index.php?title=Variables
https://www.youtube.com/watch?v=1aXWMLhSjjM

Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
03 Apr 2014 12:03 PM
Generally, variables are lengthy and the names themselves describe the functionality of said variable.

For instance:


local numLoops = 5 -- how many loops to do
for i = 1, numLoops do
-- in this case, i isn't exactly used in the script
print( 'I'm looping!' )
end




This loops 5 times.
Another is with GUIs. I like to name my variables according to the frames of my GUI. If I have a shop button for in-game items, I'll call it GameShop. If I have a shop button for VIP features (say, through dev products), I'll call it VipShop.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
03 Apr 2014 12:09 PM
_ = 1
___ = 3
_____ = {}
____ = function(_) return _ + ___ end


_____[____(___) + _]
Report Abuse
AetherShotgun is not online. AetherShotgun
Joined: 17 Mar 2014
Total Posts: 656
03 Apr 2014 03:54 PM
What if you have two, very similar variables?

For example: I am going have to use on for the first player, and in the same script access player 1 playing a co-op game.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
03 Apr 2014 03:55 PM
It is up to you, as long as you can keep track of what you name things and you don't plan on giving the script away (so others don't get confused)
Report Abuse
AetherShotgun is not online. AetherShotgun
Joined: 17 Mar 2014
Total Posts: 656
03 Apr 2014 03:56 PM
That's just it, I want it to be a very easy to modify script. For free models to make current free modeled games better.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
03 Apr 2014 03:57 PM
For example: I am going have to use on for the first player, and in the same script access player 1 playing a co-op game.

You could make your variables named:
local coOpFirstPlayer = blah
local coOpSecondPlayer = blah
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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