Home Contents | # Iterating over messages | Mtd16 | Core4 Lua Commands

## SYNOPSIS

1. msgCode = msg:messageCode()
2. msgCode = msg:nextMessageCode()
3. msg:rewind()

## DESCRIPTION

A message buffer instance might contain multiple concatenated messages. Call msg:messageCode() to retrieve the tag of the current message and msg:nextMessageCode() to iterate to the next message and return its tag.

By calling msg:rewind(), you can start over processing the concatenated messages.

## RETURN VALUE

msg:messageCode() and msg:nextMessageCode() return the numerical value of the messages code or nil if there is no message.

## EXAMPLE

> > >
msg = mtd16.fromData("\x0B\x00\x0F\xF0\x07\x00\x01\x30XYZZY") tag = msg:messageCode() print(string.format("0x%04X", tag)
0xF00F

## SEE ALSO

#mtd16, mtd16.answerCode, mtd16.fromData, mtd16.fromText, mtd16.isNestedTag, mtd16.lutType, mtd16.new, mtd16.tagCode, mtd16.tagName, mtd16.tagNumber, mtd16.tagType, mtd16:append, mtd16:appendMessageCode, mtd16:contains, mtd16:get, mtd16:getNumber, mtd16:getString, mtd16:isEmpty, mtd16:isValid, mtd16:pairs, mtd16:tags, mtd16:toData, mtd16:toText, mtd16:trace, tostring(mtd16)