Sandbox `write_message`

Exposes a `write_message` function to Lua decoders that allows mutation of the message triggering the decode operation. Resolves #577.