|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 03 Apr 2014 12:09 PM |
_ = 1 ___ = 3 _____ = {} ____ = function(_) return _ + ___ end
_____[____(___) + _] |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|