You should have a look at either dissect_tcp_pdus(), described in Section 11.6.8.2 of the Wireshark Developer's Guide, or if you're unable to make use of that function, you may have to handle segments more "manually", in which case I'll refer you to the TCP reassembly section of the Lua/Dissectors wiki page and the excellent fpm.lua example found on the Lua/Examples wiki page.