olivine-labs / lua-style-guide Goto Github PK
View Code? Open in Web Editor NEWOlivine Labs Lua Style Guide
Olivine Labs Lua Style Guide
Lua does not have autmagic arg
-s anymore. What is your favorite style for functions that take variadic arguments? Using local arg = {...}
, select()
, both?
-- nils don't count
local list = {}
list[0] = nil
list[1] = "item"
print(#list) -- 0
print(select('#', list)) -- 1
They are in the ToC but the links lead nowhere
Does this styleguide work against any Lua-based Linting software out there?
In the function section, you advocate function syntax over variable syntax. You name the "bad" function "yup" and the "good" function "nope". It's difficult to know which style you prefer because of the misleading naming.
In the naming convention section, you advocate the use underscores for ignored variables. Both code snippets are labeled as "good" despite one using "k, v in pairs()"
In the functions section, the link mentioned, doesn't open.
Could Lustache be used to create a linter based on your style guide?
In Olivine-Labs/lua-style-guide#whitespace, in item
Place an empty newline at the end of the file.
The fenced code box for good does not show the newline. I don't know if this could be fixed, I didn't find a use case for that in the documentation.
-- good
local me = {
fullname = function(self)
return self.first_name + " " + self.last_name
end
}
Use one space after commas.
...
--good
local thing = {1, 2, 3}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.