Add lua function to serialize a table