Skip to main content


msg:context_get — Get a context variable


msg:context_get(type, key);

type: numeric
key: string


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')


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

Was this page helpful?