Skip to content

Commit 91200e0

Browse files
committed
Remove anon functions rule
1 parent 42af517 commit 91200e0

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

mtasa-resources/CODING_GUIDELINES.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,6 @@ end
8181
addEventHandler("onPlayerJoin", root, playerJoin)
8282
```
8383

84-
### Avoid anonymous functions
85-
86-
Rather than using anonymous functions (i.e when calling [`addEventHandler`](https://wiki.multitheftauto.com/wiki/AddEventHandler)), use a named local function instead. For example:
87-
88-
```lua
89-
-- Rather than this:
90-
addEventHandler("onPlayerConnect", root, function()
91-
outputChatBox("Hello!")
92-
end)
93-
94-
-- Do this:
95-
local function onConnect()
96-
outputChatBox("Hello!")
97-
end
98-
addEventHandler("onPlayerConnect", root, onConnect)
99-
```
100-
10184
### Consistent naming conventions
10285

10386
All function names and variables should use the camel case naming convention. Constant variables should use upper snake case (see below).

0 commit comments

Comments
 (0)