diff --git a/CODE_STYLE.md b/CODE_STYLE.md index e7a00bc13a46..9b25f552cf90 100644 --- a/CODE_STYLE.md +++ b/CODE_STYLE.md @@ -320,6 +320,24 @@ local function check(age, name) end ``` +The function should return ``, `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: