title: How to create a Protofield sub array for Lua Wireshark Dissector
body: <p>Given the following example:</p>
  
  <pre><code>local f= mycoolprotocol.fields
  f.Length = ProtoField.uint32("MCP.Length","Length",base.DEC)
  f.MsgType = ProtoField.uint16("MCP.MsgType","MsgType",base.DEC)
  </code></pre>
  
  <p>I have declared 2 Protofields. But imagine I have a repeating group or an array of items:</p>
  
  <p>And the message body looks like so:</p>
  
  <pre><code>struct person
  {
    int16 age;
    string name;
  }
  person[] p = new person[2];
  </code></pre>
  
  <p>Ideally, I would like to create a subtree in Wireshark for that group</p>
  
  <pre><code>+ Persons
   + Person1
      name
      age
   + Person2
      name
      age
  </code></pre>
  
  <p>The problem is I don't know how to structure this in Lua. This declares 2 protofields:</p>
  
  <pre><code>f.name = Protofield.string("MCP.name","name","Text")
  f.age = ProtoField.uint16("MCP.age","age",base.DEC)
  </code></pre>
  
  <p>But  I'd like to create a dynamic array of the group instead, so I can do:</p>
  
  <pre><code>subtree:add_le( f[0].name, buffer(x,y)) 
  </code></pre>
  
  <p>So, is there a <code>Protofield.ProtoFieldArray</code>?
  Is it possible? Any other ideas are welcome.</p>
  
  <p>Thanks.</p>
  
  <p>Also, as reference:
  <a href="http://ask.wireshark.org/questions/28038/how-to-create-a-protofield-sub-array-in-lua" rel="nofollow">http://ask.wireshark.org/questions/28038/how-to-create-a-protofield-sub-array-in-lua</a></p>