/
devguidelines.html
89 lines (85 loc) · 3.77 KB
/
devguidelines.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html>
<head>
<title>Mesecons - Developer Guidelines</title>
<meta name="viewport" content="width=width, initial-scale=1.0">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Titillium+Web' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Cantarell' rel='stylesheet' type='text/css'>
<script src="common.js"></script>
<script src="items.js"></script>
<link rel="stylesheet" href="styles.css" />
<link rel="stylesheet" href="developers.css" />
</head>
<body>
<div id="header">
<img id="header_logo" src="img/logo.png">
<div id="header_logotext">Mesecons</div>
<div id="header_menu">
<a class="header_menuitem" href="items.html">Items</a>
<a class="header_menuitem" href="digilines.html">Digilines</a>
<a class="header_menuitem" href="developers.html">Developers</a>
</div>
</div>
<div class="banner banner-developers"></div>
<div id="developers">
<div class = "article-heading">Development Guidelines</div>
<div class = "text">
Make sure you follow these guidelines to get your own code merged for sure!<br/>
If you are not sure if your code complies, just send it in; we'll tell you in case it doesn't.
<div class = "paragraph-heading">Code</div>
<div class = "code"><pre>
-- do_something_one(foo) --> Makes xyz
-- do_something_two(foo) --> Makes zxy; foo is a table that contains yxz
local do_something_one = function(foo) *
local bar = {} *
for n, f in ipairs(foo) do
if (foo == 5) then
return foo
else
bar.x = f **
bar[n] = f **
table.insert(bar, f)
print("test")
end
end
6*
for _, b in pairs(bar) do
print(dump(f))
end
end
6*
register_something("foo", function(foo, bar) ***
if not foo then return end ****
if (foo == bar) then
print("foo = bar")
else
do_something_one (foo) 5*
do_something_two (foo) 5*
do_something_tree (foo) 5*
do_something__with_a_ver_long_name_and_long_parameter_list
(foo, bar, "1", 2, "3", 4) 7*
end
end)
</pre></div><br/>
There you go, that is some reference code for the coding style.<br/>
* = Make sure functions and variables that don't need to be public are defined local<br/>
** = To modify an array member by its index, preferably use bar.foo, not bar["foo"] if not required<br/>
*** = Define functions inside registrations; Makes things clearer, you know which function belongs to which registration<br/>
**** = You can put simple if constructions in one line only or use one line if the ifs do the same thing over and over again.<br/>
5* = If you use functions with similar parameters, it looks better to make it like the parameters are in a vertical line.<br/>
6* = Make spaces and empty lines between functions and inside functions for segments<br/>
7* = If a line becomes very long, try to split it. Try not to use more than 100 chars per line.<br/><br/>
<b>Random</b>
<li>Use tabs, no spaces</li>
<li>Don't use too many comments, you can describe something at the head of your code</li>
<li>You can use the sample code above also for other things (e.g. shows where to make spaces)</li><br/>
<div class = "paragraph-heading">GitHub</div>
<li>Use GitHub to send in your code. Git is not too hard!</li>
<li>You can send incomplete pull requests, but explain what is missing</li>
<li>Describe your pull request, what it does and what does not work!</li>
<li>You may also provide screenshots if you implement new features</li>
<li>If you implement new features, you should also send in an update for mesecons.net <a href="https://github.com/Jeija/mesecons.net">here</a>
</div></div>
</body>
</html>