Login
Sign Up


You are using the mobile version of the forum, some features have been disabled to have it responsive.
Limelight Reunion 2024 - v4b1Limelight Discord
Ares Defence Services Discord
Limelight Reunion 2024 - v4b1Limelight DiscordAres Defence Services Discord

receiptDevelopment Blog:

Development Contributor Workflow

receiptHR Blog:

What *are* they doing over there?

receiptTeacher Blog:

Insight into the Teacher Team

receiptDevelopment Blog:

Infrastructure Upgrade 11/2019

receiptDevelopment Blog:

how suggestions???

receiptDevelopment Blog:

Planning for the future.


This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Closed 
The LL Lua Style Guide
Doctor Internet radio_button_checked
Management, Developer, Administrator, Business Adviser, DPO, Security
Core Manager
Posts: 12,549
Threads: 1,763
Likes Given: 425
Likes Recieved: 3471 in 1669 posts
Joined: Aug 2015
Reputation: 35
#1
Oct 17, 2017, 10:07 AM
Following RFC LL-001, this is now the official LL style guide for Lua. Any new code should follow this style.
Modifications may be proposed through a new RFC, which suggests alterations to the prior RFC.

Quote:Code Layout
Tabs or Spaces?
Always tabs.
For leading whitespace, always use tabs.

C vs Lua Style
Always use Lua style operators (--[[]]-- vs /**/, ~= vs !=, not vs !), to allow for external lua parsers.

Semicolons.
Use discouraged, except in run-on single-line operations.
if condition then x = 7; y = 2; return x, y end

Maximum Line Length
Maximum Recommended Length: 100 Characters.
Soft Limit (I'll start getting pissed if all your lines are longer than this): 150 Characters.
Hard Limit (No lines longer than): 250 Characters.

Blank Lines
Do not include whitespace on blank lines.

Top-level function and class definitions are seperated by a single blank line.

Use single blank lines within method or functions bodies, where this will improve readability.

Encoding
UTF-8 is prefered.

Operator and Function Whitespace
Avoid extra whitespace in the following situations.
Prior to parentheses, brackets or braces.
print("My Argument") is allowed and encouraged.
print( "My Argument" ) is discouraged.
print( "My Argument") is highly discouraged.
print( "My Argument" ) is just pissing me off.

Immediately prior to a comma.
print(x, y) is allowed and encouraged.
print(x,y) is allowed, but discouraged.
print(x , y) is discouraged.

Exception:
During colour, angle or vector definitions, where all components are 0, no spacing is encouraged.
Angle(0,0,0) is allowed and encouraged.
Angle(0, 0, 0) is allowed.

Always surround the following operators with a single space on each side.
Assignment (=)
Comparison (==, <, >, <=, >=, !=, ~=)
Arithmetic Operators (+, -, *, /)

x = 1
y = 1
z = x + y
steamID = 10
-- Allowed and encouraged.

x = 1
y = 2
z = x + y
steamID = 10
-- Discouraged.

Naming Conventions
Variables, Fields and Methods use either lowerCamelCase or UpperCamelCase (personal preference)
Enum use Uppercase /w Underscores (EMOTE_DRUNK)

Variable names should be short and self-descriptive.
Variable names should not be single letters, except where allowable due to loop or convention (i for loop iterator, x for loop iterator's value, k for key, v for value, x/y for coordinate pairs)

Exmaples
mySuperVariable is discouraged, as it does not describe the purpose of the variable.
storedCmds is encouraged, as it's short and describes the purpose of the variable (stores commands).
TheVariableThatStoresAllTheWordsInTheDictionaryBecauseINeedItForSomeReason is discouraged, as it's long, and thus harder to read and type.

Comments
First word should be capitalised, unless the word is an identifier starting with a lower-case letter.
If a comment is short, the ending full-stop may be omitted.
Comments should either be on the line precending the code, or on the line of the code.

Block Comments
Block comments apply to the following code block.
Use Lua style operators for block comments.
When closing a pre-code block, block comment, use ]]--.

Inline Comments
Inline comments start with a double dash, and a single space.

Function-Doc Comments
Prior to any function, a LuaDoc style function documentation comment needs to be added.
Start with a triple dash (---), with secondary lines starting with a double-dash (--).
The description can be over multiple lines. The description must end with a full-stop.

Header
The header starts with a double dash, double open square bracket, and double dash (--[[--).
The first line contains the opening, a space, and the short description.
Following lines contain the extended description.
Following lines contain the tags.
Final line contains the closing tag, which is a double dash, double close square bracket, double dash (--]]--)

Required Tags
author
copyright
release

Example
--[[-- Clientside code relating to the chatbox.
Does stuff and things about the chatbox, like displaying chat, recieving messages and shit like that.
@copyright 2015-2017 Limelight Gaming
@release CityRP 2
@author Legacy Team
--]]--

Tag Lines.
Tag lines start with a double dash, a space and a @.
author - Defines the author of a module or file.
copyright - Defines the copyright of the mdoule/file.
field - Descripts a table field definition.
param - Takes two arguuments, the name of a function param and the description.
release - String describing the release of the module or file.
return - Describes a function return value.
see - Refer to other function or table.
useage - Describe the use of the function or variable.

Example
--- The description of the function
-- which can be spread over multiple lines.
-- @param p1 The first argument
-- @param p2 The second arguments.
-- @return A string value
-- @retuyn A secondary string value
-- @see table.concat
function testFunc(p1, p2)
return "Hi", "Internet"
end

Strings
Prefer double-quoted strings over single-quoted strings.
For Data Protection Queries, please email info@limelightgaming.net.
For Business, Contributor or Development queries, please PM me.
For Appeals, please post in the relevant subforum.
For Security Information, your best bet is to speak to Burnett.
The following 4 users Like Doctor Internet's post:
  • Adam James, D3ST, Vadar, yutgjctguc
Doctor Internet radio_button_checked
Management, Developer, Administrator, Business Adviser, DPO, Security
Core Manager
Posts: 12,549
Threads: 1,763
Likes Given: 425
Likes Recieved: 3471 in 1669 posts
Joined: Aug 2015
Reputation: 35
#2
Jan 24, 2018, 09:27 AM
Please note, MyBB is bad at keeping whitespace, so some of the examples are incorrect. The actual descriptions given however, are correct.
For Data Protection Queries, please email info@limelightgaming.net.
For Business, Contributor or Development queries, please PM me.
For Appeals, please post in the relevant subforum.
For Security Information, your best bet is to speak to Burnett.
The following 1 user Likes Doctor Internet's post:
  • Vadar
ToiletWater radio_button_checked
Member
Membership
Posts: 307
Threads: 30
Likes Given: 455
Likes Recieved: 141 in 101 posts
Joined: Nov 2017
Reputation: 7
#3
Jan 25, 2018, 06:46 PM
Is this even fucking English?
Signature rights suspended. Contact Nightmare for reference.
The following 1 user Likes ToiletWater's post:
  • CJT
Soviethooves radio_button_checked
American Player
Media Contractor
Posts: 6,711
Threads: 185
Likes Given: 3303
Likes Recieved: 3986 in 2172 posts
Joined: Aug 2015
Reputation: 33
#4
Jan 25, 2018, 08:21 PM
(Jan 25, 2018, 06:46 PM)Boshine Wrote: Is this even fucking English?

Not to us.
<span id="sceditor-end-marker" class="sceditor-selection sceditor-ignore" style="line-height: 0; display: none;"> </span><span id="sceditor-start-marker" class="sceditor-selection sceditor-ignore" style="line-height: 0; display: none;"> </span>
[Image: n0LLhCI.jpg]
Doctor Internet radio_button_checked
Management, Developer, Administrator, Business Adviser, DPO, Security
Core Manager
Posts: 12,549
Threads: 1,763
Likes Given: 425
Likes Recieved: 3471 in 1669 posts
Joined: Aug 2015
Reputation: 35
#5
Jan 25, 2018, 09:15 PM
(Jan 25, 2018, 08:21 PM)Gungranny Wrote:
(Jan 25, 2018, 06:46 PM)Boshine Wrote: Is this even fucking English?

Not to us.

beep boop exterminate
For Data Protection Queries, please email info@limelightgaming.net.
For Business, Contributor or Development queries, please PM me.
For Appeals, please post in the relevant subforum.
For Security Information, your best bet is to speak to Burnett.
The following 2 users Like Doctor Internet's post:
  • Haamster, ToiletWater
Soviethooves radio_button_checked
American Player
Media Contractor
Posts: 6,711
Threads: 185
Likes Given: 3303
Likes Recieved: 3986 in 2172 posts
Joined: Aug 2015
Reputation: 33
#6
Jan 25, 2018, 09:34 PM
(Jan 25, 2018, 09:15 PM)Doctor Internet Wrote:
(Jan 25, 2018, 08:21 PM)Gungranny Wrote:
(Jan 25, 2018, 06:46 PM)Boshine Wrote: Is this even fucking English?

Not to us.

beep boop exterminate

I loved Stark Trek Generations
<span id="sceditor-end-marker" class="sceditor-selection sceditor-ignore" style="line-height: 0; display: none;"> </span><span id="sceditor-start-marker" class="sceditor-selection sceditor-ignore" style="line-height: 0; display: none;"> </span>
[Image: n0LLhCI.jpg]
ToiletWater radio_button_checked
Member
Membership
Posts: 307
Threads: 30
Likes Given: 455
Likes Recieved: 141 in 101 posts
Joined: Nov 2017
Reputation: 7
#7
Jan 28, 2018, 08:35 PM
(Jan 25, 2018, 09:34 PM)Gungranny Wrote:
(Jan 25, 2018, 09:15 PM)Doctor Internet Wrote:
(Jan 25, 2018, 08:21 PM)Gungranny Wrote:
(Jan 25, 2018, 06:46 PM)Boshine Wrote: Is this even fucking English?

Not to us.

beep boop exterminate

I loved Stark Trek Generations

Your so smart, he's on about Doctor Who u boombaload @"Gungranny"
Signature rights suspended. Contact Nightmare for reference.
(This post was last modified: Jan 28, 2018, 08:37 PM by ToiletWater. Edited 1 time in total.)
The following 1 user Likes ToiletWater's post:
  • Quest
Soviethooves radio_button_checked
American Player
Media Contractor
Posts: 6,711
Threads: 185
Likes Given: 3303
Likes Recieved: 3986 in 2172 posts
Joined: Aug 2015
Reputation: 33
#8
Jan 28, 2018, 09:21 PM
(Jan 28, 2018, 08:35 PM)Boshine Wrote:
(Jan 25, 2018, 09:34 PM)Gungranny Wrote:
(Jan 25, 2018, 09:15 PM)Doctor Internet Wrote:
(Jan 25, 2018, 08:21 PM)Gungranny Wrote:
(Jan 25, 2018, 06:46 PM)Boshine Wrote: Is this even fucking English?

Not to us.

beep boop exterminate

I loved Stark Trek Generations

Your so smart, he's on about Doctor Who u boombaload @"Gungranny"

 https://i.imgur.com/L85IbAt.png
<span id="sceditor-end-marker" class="sceditor-selection sceditor-ignore" style="line-height: 0; display: none;"> </span><span id="sceditor-start-marker" class="sceditor-selection sceditor-ignore" style="line-height: 0; display: none;"> </span>
[Image: n0LLhCI.jpg]
(This post was last modified: Jan 28, 2018, 09:21 PM by Soviethooves.)
ToiletWater radio_button_checked
Member
Membership
Posts: 307
Threads: 30
Likes Given: 455
Likes Recieved: 141 in 101 posts
Joined: Nov 2017
Reputation: 7
#9
Jan 28, 2018, 10:35 PM
https://vignette.wikia.nocookie.net/simp...0606181712

@"Gungranny"
Signature rights suspended. Contact Nightmare for reference.
(This post was last modified: Jan 28, 2018, 11:31 PM by ToiletWater. Edited 2 times in total.)
Kvatch radio_button_checked
Member
Membership
Posts: 782
Threads: 87
Likes Given: 791
Likes Recieved: 517 in 267 posts
Joined: Aug 2015
Reputation: 8
#10
Jan 29, 2018, 01:56 PM
I did a GCSE in Computer Science and we did the whole course in Python (where we were writing code). As a "proficient" Python user, how easy would it be to learn Lua enough to code alongside developers like Limelight's? I'm not asking to be a developer I'm just asking to find out how easy it would be to learn Lua with a python background from a Gmod programmers point of view.

Forum Rep  |  Steam Profile
Doctor Internet radio_button_checked
Management, Developer, Administrator, Business Adviser, DPO, Security
Core Manager
Posts: 12,549
Threads: 1,763
Likes Given: 425
Likes Recieved: 3471 in 1669 posts
Joined: Aug 2015
Reputation: 35
#11
Jan 29, 2018, 02:02 PM
(Jan 29, 2018, 01:56 PM)kvatch Wrote: I did a GCSE in Computer Science and we did the whole course in Python (where we were writing code). As a "proficient" Python user, how easy would it be to learn Lua enough to code alongside developers like Limelight's? I'm not asking to be a developer I'm just asking to find out how easy it would be to learn Lua with a python background from a Gmod programmers point of view.

Not that difficult. Lua is somewhat similar. https://lua-users.org/wiki/LuaVersusPython
For Data Protection Queries, please email info@limelightgaming.net.
For Business, Contributor or Development queries, please PM me.
For Appeals, please post in the relevant subforum.
For Security Information, your best bet is to speak to Burnett.
The following 2 users Like Doctor Internet's post:
  • Kvatch, Zona
Doctor Internet radio_button_checked
Management, Developer, Administrator, Business Adviser, DPO, Security
Core Manager
Posts: 12,549
Threads: 1,763
Likes Given: 425
Likes Recieved: 3471 in 1669 posts
Joined: Aug 2015
Reputation: 35
#12
Sep 12, 2019, 10:11 PM
arch, see https://limelightgaming.net/forums/thread-25834.html
For Data Protection Queries, please email info@limelightgaming.net.
For Business, Contributor or Development queries, please PM me.
For Appeals, please post in the relevant subforum.
For Security Information, your best bet is to speak to Burnett.
Closed 




Users browsing this thread: 1 Guest(s)