local UdpMsgLen = Filed.new('udp.length')


local foo = Proto ("foo", "FOO")

function foo.dissector(buffer, pinfo, tree)

	local subtree = tree:add(proto, buffer())
	...

	local UdpLength=tostring(UdpMsgLen())
	local CompleteBuffer = Byte.Array.new()
	 
	if (some condition on leftover from previous packet)

		local first_part_tvb = ByteArray.tvb(partialBuffer[0])
		...

		newTvb = ByteArray.tvb(partialBuffer[0]:subset(0,partialBuffer[0]:len() .. buffer(x,y):bytes()) -– x,y are location and how many bytes
		dissector_table:try(messageId, newTvb, pinfo, tree)
		partialBuffer={}
	end
		...

	if (condition that there is still some data)
		partialBuffer[0] = buffer(v,u):bytes()   --v, u location and how many bytes shall pass to next message
		completeBuffer = completeBuffer .. partialBuffer[0]
	else
		dissector_table:try(messageId, newTvb, pinfo, tree)
	end
	
end