
local function SampleUnitMagAndWeaponDumpToConsole(u)
    if u~=nil then
        print("Mags for " .. u.name); 
        for k,v in ipairs(u.magazines) do
 --           print(v);
            print(" -Magazine name: ".. tostring(v.mag_name) .."  mag_guid: ".. tostring(v.mag_guid) .."  capacity: ".. tostring(v.mag_capacity) .. "  mag_dbid: ".. tostring(v.mag_dbid));
            if #v.mag_weapons then print("  -Weapons:"); end
            for i,j in ipairs(v.mag_weapons) do
                print(string.format("    -name: %s  wpn_guid: %s  current: %s  max: %s  default: %s",tostring(j.wpn_name), tostring(j.wpn_guid),tostring(j.wpn_current), tostring(j.wpn_maxcap), tostring(j.wpn_default)));
            end
        end
    else
        print("Um you didn't provide a valid unit. double check the guid is a unit that exists.");
    end
end

--Modify the next line's guid with unit you want too dump! (ctrl-c, ctrl-v into editor with unit selected)
local u = ScenEdit_GetUnit({name='DDG 125 #1', guid='4FH7PU-0HMNDPRJL9Q17'}) --replace with a ctrl-c from unit you want to dump.
SampleUnitMagAndWeaponDumpToConsole(u);