-- first nested table
local file_magic_1 =
{
    { type = "LNK", id = 1000, category = "Windows Shell Link Shortcut", rev = 1,
      magic = { { content = "| 4C 00 00 00 01 14 02 00 |",offset = 0 } } }
}

-- second nested table
local file_magic_2 =
{
    { type = "PDF", id = 22, category = "PDF files", rev = 1,
      magic = { { content = "| 25 50 44 46|",offset = 0 } } }
}

-- merge the tables
function mergetbl( fm1,fm2 )
    for k,v in ipairs(fm2) do
        table.insert(fm1, v)
    end
    return fm1
end

-- print each element
function printtbl( t,tab,lookup )
   local lookup = lookup or { [t] = 1 }
   local tab = tab or ""
   for i,v in pairs( t ) do
      print( tab..tostring(i), v )
      if type(i) == "table" and not lookup[i] then
         lookup[i] = 1
         print( tab.."Table: i" )
         printtbl( i,tab.."\t",lookup )
      end
      if type(v) == "table" and not lookup[v] then
         lookup[v] = 1
         print( tab.."Table: v" )
         printtbl( v,tab.."\t",lookup )
      end
   end
end

printtbl(mergetbl( file_magic_1,file_magic_2 ))