Skip to content

Commit

Permalink
docs: specify function return value (#8115)
Browse files Browse the repository at this point in the history
  • Loading branch information
kingluo authored Oct 21, 2022
1 parent 3697460 commit ecdc209
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions CODE_STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,24 @@ local function check(age, name)
end
```

The function should return `<boolean>`, `err`.
The first return value means successful or not, if not, the second return value specifies the error message.
The error message can be ignored in some case.

```lua
--No
local function check()
return "failed"
end
```

```lua
--Yes
local function check()
return false, "failed"
end
```

## Module

All require libraries must be localized:
Expand Down

0 comments on commit ecdc209

Please sign in to comment.