load_subtree = function(id, out, depth) -- load a file and recursively all replies to it -- print('load_subtree', id) local item = initialize_item(id, depth) -- every item renders to a row consisting of two -- columns: padding and 'item stuff' local row = cols(Inter_comment_spacing) table.insert(out, row) table.insert(row.data, indent(depth)) -- item stuff consists of text and a reply button local item_stuff = rows() table.insert(row.data, item_stuff) table.insert(item_stuff.data, item) table.insert(item_stuff.data, reply_button(id, depth)) for i,reply_id in ipairs(item.metadata.replies) do local reply = load_subtree(reply_id, out, depth+1) end return item end