msg:context_get

March 26, 2020 Contributors

Name

msg:context_get — Get a context variable

Synopsis

msg:context_get(type, key);

type: numeric
key: string

Description

Get a context variable. Legal values for type are:

  • msys.core.ECMESS_CTX_MESS

  • msys.core.ECMESS_CTX_CONN

local val = 1
msg:context_set(msys.core.ECMESS_CTX_MESS, 'key', 'val')
local messval = msg:context_get(msys.core.ECMESS_CTX_MESS, 'key')

Note

This function always returns a string. In the code example given above, the context variable key is returned as the string value '1' and not as a numeric value.

Because this function is in the msys.core namespace, an explicit require('msys.core') is not necessary.

See Also

msg:context_set, msg:context_exists, and msg:context_exists_and_get