Home  Contents

mtd16:pairs

Mtd16 Core4 Lua Commands

SYNOPSIS

  1. fortag, data in msg:pairs() ...
  2. fortag in msg:tags() ...

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