vctx:set
March 26, 2020
Name
vctx:set — Set the value of a context variable
Synopsis
vctx:set(type, key, value);
type: numeric key: string value: mixed
Description
Set the value of a context variable. The type
parameter can be either msys.core.VCTX_MESS
or msys.core.VCTX_CONN
.
require("msys.core"); require("msys.brightmail"); local mod = {}; function mod:validate_data(msg, accept, vctx) local verdict, is_default, rules, tracker = msys.brightmail.scan(msg, accept, vctx) print("verdict:", verdict, " is_default:", is_default, " rules:", rules, " tracker:", tracker) vctx:set(msys.core.VCTX_MESS, 'bm_verdict', verdict) return msys.core.VALIDATE_CONT; end msys.registerModule("bm", mod);
Because this function is in the msys.core
namespace, an explicit require('msys.core')
is not necessary.