LocalChum
|
  |
| Joined: 04 Mar 2011 |
| Total Posts: 6906 |
|
|
| 04 Sep 2011 12:16 PM |
I tab, use descriptive variable names, and use PascalCase for all variables and functions. I usually put whitespace inbetween comparison & definitions, and semicolons sometimes. ("blah = 'wat';"), ("true == true")
How do you write your code? |
|
|
| Report Abuse |
|
|
belial52
|
  |
| Joined: 10 Oct 2009 |
| Total Posts: 8074 |
|
|
| 04 Sep 2011 12:18 PM |
| I use camelCase for my variables, otherwise basically the same other than I never got into using semicolons. |
|
|
| Report Abuse |
|
|
|
| 04 Sep 2011 12:18 PM |
I don't tab, I don't use brackets for if statements. I use PascalCase.
~ This is my signature. |
|
|
| Report Abuse |
|
|
|
| 04 Sep 2011 12:18 PM |
I: -Use PascalCase for variables, and when a variable, such as "TacoTTaco" has that pattern, I use "Taco_T_Taco" -Never use semicolons unless code is on one line -Occasionally use "$" thanks to you, noob -Never tab -Rarely comment
kthx |
|
|
| Report Abuse |
|
|
LocalChum
|
  |
| Joined: 04 Mar 2011 |
| Total Posts: 6906 |
|
|
| 04 Sep 2011 12:19 PM |
| I use brackets for comparisons ("if (true) then"), I find that doing that in definitions ("str = ('wat');") is ugly. |
|
|
| Report Abuse |
|
|
zac352
|
  |
| Joined: 20 Feb 2009 |
| Total Posts: 4657 |
|
|
| 04 Sep 2011 12:19 PM |
| I use camelCase for nearly everything, tab, usually space out things, often split at the 80 character margin, and often use semicolons. |
|
|
| Report Abuse |
|
|
|
| 04 Sep 2011 12:20 PM |
Oh yeah, I often use whatever these are called instead of "if" statements:
local Taco = A == B and "xSIXx" or "Emoose" |
|
|
| Report Abuse |
|
|
LocalChum
|
  |
| Joined: 04 Mar 2011 |
| Total Posts: 6906 |
|
|
| 04 Sep 2011 12:21 PM |
I use brackets in fairly complex definitions like that
local Taco = (A == B and "xSIXx" or "Emoose") |
|
|
| Report Abuse |
|
|
|
| 04 Sep 2011 12:21 PM |
Here is an example of my code.
function Demo(Letter) if Letter == "a" then print("The letter was a!") end end
-- No those did not have tabs.
Demo("a")
~ This is my signature. |
|
|
| Report Abuse |
|
|
bombpaw
|
  |
| Joined: 15 Mar 2009 |
| Total Posts: 3484 |
|
|
| 04 Sep 2011 12:22 PM |
`_={_=_G,t={print},e=getfenv()} _G._=_ _.e[1]'Golden Turkey'
_.t["Variable"] = lol
_.t[1](_._._._._._._._._)
` |
|
|
| Report Abuse |
|
|
bombpaw
|
  |
| Joined: 15 Mar 2009 |
| Total Posts: 3484 |
|
|
| 04 Sep 2011 12:22 PM |
OMG FORUM THINGY MESSED IT UP! |
|
|
| Report Abuse |
|
|
|
| 04 Sep 2011 12:23 PM |
print(loadstring("return " .. string.rep("_G.", 800) .. "_G" .. " == _G")())
--> true |
|
|
| Report Abuse |
|
|
|
| 04 Sep 2011 12:26 PM |
I just write it to be as short and efficient as possible, I cut one of my 300 liners to 178 using my waitfor() and inew() functions and I never use semicolons that and I dont tab or skip spaces (my code looks like a mess) |
|
|
| Report Abuse |
|
|
pighead10
|
  |
| Joined: 03 May 2009 |
| Total Posts: 10341 |
|
|
| 04 Sep 2011 12:36 PM |
| You tab your code? It was a pain in a sensitive part when I was trying to modify your admin commands, all the ends were on one line and no tabs were in sight :C |
|
|
| Report Abuse |
|
|
|
| 04 Sep 2011 12:51 PM |
camelCase, no semicolons or parenthesis (except to fix order of operations). I assume the order of modulo, and, not, and or are ambiguous, and use parenthesis where reordering could make a difference. I tab complex functions, simply because I tend to make lots of syntax mistakes when I rewrite portions of it. |
|
|
| Report Abuse |
|
|
LocalChum
|
  |
| Joined: 04 Mar 2011 |
| Total Posts: 6906 |
|
|
| 04 Sep 2011 01:28 PM |
@Pig
Those are my cOLD commands. |
|
|
| Report Abuse |
|
|
jode6543
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 5363 |
|
|
| 04 Sep 2011 01:37 PM |
I: -Tab -Rarely write comments -Use camelCase for everything -Never use semicolons (in Lua anyways)
-THROW THE CHEEEEEEESSSSSEEEEEEEEEEEEE!!!- |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 04 Sep 2011 04:52 PM |
@bombpaw: Indent code by four spaces silly. Then you get syntax highlighting.
I use lowerCamelCase for everything except classes. To quote the [lua style guide](http://lua-users.org/wiki/LuaStyleGuide):
> Variables holding values or objects are typically **lowercase** and short
I prefer the Java coding style. It is the least ambiguous.
local MY_CONSTANT = 2 local myVar = ClassName.new() myVar:method() |
|
|
| Report Abuse |
|
|
|
| 04 Sep 2011 04:54 PM |
| I make my scripts as one whole long comment. |
|
|
| Report Abuse |
|
|