Difference between revisions of "MinetestWiki:Style Guide"
Jump to navigation
Jump to search
(Created page with "Indent source code either with 2/4 spaces or tab character. Put spaces before and after binary operators, don't put spaces after unary operators (<source enclose="none">loc...") |
|||
Line 7: | Line 7: | ||
<pre>[InvRef]add_item("listname", stack)</pre> → <source enclose="none">[InvRef]add_item("listname", stack)</source> (link is made to point to [[InvRef:add_item]]) | <pre>[InvRef]add_item("listname", stack)</pre> → <source enclose="none">[InvRef]add_item("listname", stack)</source> (link is made to point to [[InvRef:add_item]]) | ||
+ | |||
+ | == Method template == | ||
+ | <pre> | ||
+ | {{DISPLAYTITLE:minetest.new_awesome_method}} | ||
+ | == Syntax == | ||
+ | <source>minetest.new_awesome_method("string", {table}, variable)</source> | ||
+ | |||
+ | == Description == | ||
+ | Do something. | ||
+ | |||
+ | == Example == | ||
+ | <source> | ||
+ | minetest.new_awesome_method("lol", {wtf}, 42) | ||
+ | </source> | ||
+ | |||
+ | [[Category:Methods]] | ||
+ | </pre> |
Revision as of 13:29, 28 November 2012
Indent source code either with 2/4 spaces or tab character.
Put spaces before and after binary operators, don't put spaces after unary operators (local b = -a + 3 * (c - a) / 2
)
[casting]
add_item("listname", stack)
→ add_item("listname", stack)
(link points to EnvRef:add_item)
[InvRef]add_item("listname", stack)
→ [InvRef]add_item("listname", stack)
(link is made to point to InvRef:add_item)
Method template
{{DISPLAYTITLE:minetest.new_awesome_method}} == Syntax == <source>minetest.new_awesome_method("string", {table}, variable)</source> == Description == Do something. == Example == <source> minetest.new_awesome_method("lol", {wtf}, 42) </source> [[Category:Methods]]