Skip to main content

Name

msg:code — Get or set the message code

Synopsis

require('msys.extended.message')

msg:code(number, str);

number: number (optional)
str: string (optional)

Description

Get or set the message code. In the case of a "get call", the parameter list is left empty. In the case of "set call", if number is 0, then the number is taken from str, otherwise, the number is prefixed to str. If the string passed to str is multi-line and/or the number needs to be prefixed, then the string will be adjusted so that it forms a valid (potentially multi-line) response string.

Warning

Do not call this function from validate_set_binding.

local codestr = msg:code();

msg:code("421", "Too much spam.");

Enable this function with the statement require('msys.extended.message');.

Note

During reception, you will likely want to set the code by using vctx:set_code.

See Also

Was this page helpful?