As John Zwinck mentioned, you probably do want something like a chained dissector, which you can manage fairly straightforwardly in either Lua or C. To that end, you certainly do want to implement your logic as a dissector. In Lua, something like this:
do
--TODO set up your extra "data" field
local tcp_table = DissectorTable.get("tcp.port")
local third_party_dissector tcp_table:get_dissector(PROTO_PORT)
function your_protocol.dissector(tvb, pinfo, tree)
--call the third party dissector
third_party_dissector:call(tvb, pinfo, tree)
--TODO do what you need with the data
end
--take over the port your protocol runs over
tcp_table_add(PROTO_PORT, your_protocol)
end
Keep the API on hand, but keep in mind also that Lua dissectors in Wireshark are really just for prototyping; they are less efficient than equivalent C-based dissectors, and the API tends to lag several versions behind the C dissection API.