- fortag, data in msg:pairs() ...
- fortag in msg:tags() ...
SYNOPSIS
DESCRIPTION
These functions allow iterating over the contents of a MTD16 message. While
mtd16:pairs() iterates over both tag and data, mtd16:tags() only
returns the tags.
RETURN VALUE
Returns the tag and possibly the data contents of each field in the message until the loop ends.
NOTES
Use mtd16:pairs() only if you really need to make use of all the data contents. If you
need to access only some data fields during the loop, better use mtd16:tags() and ask for
the specific data with mtd16:get().
EXAMPLE
>
>
>
>
>
>
msg = mtd16.new(0xF00F)
msg:append(0x3001, "FNORD!")
msg:append(0x1001, 23)
for tag, data in msg:pairs() do
print(string.format("0x%04X", tag), data)
end
0x3001 FNORD!
0x1001 23
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:messageCode, mtd16:nextMessageCode, mtd16:rewind, mtd16:toData, mtd16:toText, mtd16:trace, tostring(mtd16)