Also, if you want something low-level, you can look at Mihini's serialization format:
http://git.eclipse.org/c/mihini/org.eclipse.mihini.git/tree/luafwk/luatobin/luatobin.c. It's pretty much self-sufficient (just a common header to handle endianness IIRC). It's designed for storage and RPC in embedded contexts.
It handles shared/circular references in tables, and functions without upvalues. Not userdata. As mentioned by someone else, You generally don't want to send around stuff full of metadata / upvalues / userdata anyway: they're normally part of the infrastructure exchanging data, not part of the data exchanged. And they often embed behaviors featuring a lot of side effect: you don't want those traveling across the network without a second though.