View Single Post
06/17/14, 08:26 AM   #2
ingeniousclown
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 122
This already exists as a global function implemented by ZO:
lua Code:
  1. function ZO_DeepTableCopy(source, dest)
  2.     dest = dest or {}
  3.    
  4.     for k, v in pairs(source) do
  5.         if type(v) == "table" then
  6.             dest[k] = ZO_DeepTableCopy(v)
  7.         else
  8.             dest[k] = v
  9.         end
  10.     end
  11.    
  12.     return dest
  13. end

This excludes metatables, however, and at a glance, it looks like it will crash on any circular reference.
  Reply With Quote