Necro Thread: Because I found this searching for answers to the new warehouse.... Thanks Google, Sorta.... I think updated code may help others...
-- Get the Static Object
-- WARNING: you can use Unit.getByName() and get the SO as a Unit and then warehouse functions and cargo functions fail
local AmmoStack = StaticObject.getByName("Static Ammo-1")
-- Get the Static Object instance description with :getDesc()
trigger.action.outText("SO/Unit <Static Ammo-1>: ".. net.lua2json(AmmoStack:getDesc()), 30)
-- Result: SO/Unit <Static Ammo-1>: {"life":0,"attributes":{"Cargos":true},"_origin":"","category":4,"displayName":"Ammo","typeName":"ammo_cargo","box":{"min":{"y":-0.0673937946558,"x":-0.65713477134705,"z":-0.58641439676285},"max":{"y":1.0960557460785,"x":0.65079057216644,"z":0.57894480228424}}}
-- Get the Static Object instance cargo weight with :getCargoWeight()
trigger.action.outText("CargoWeight <Static Ammo-1>: ".. net.lua2json(AmmoStack:getCargoWeight()), 30)
-- Result: CargoWeight <Static Ammo-1>: 1500
-- Access the Warehouse of the Cargo Static Object
local AmmoStackWH = Warehouse.getCargoAsWarehouse(AmmoStack)
-- Get the Warehouse Inventory within the cargo object instance with :getInventory()
trigger.action.outText("WH <Static Ammo-1>: ".. net.lua2json(AmmoStackWH:getInventory()), 30)
-- Result: WH <Static Ammo-1>: {"liquids":[0,0,0],"weapon":{"weapons.bombs.British_MC_500LB_Bomb_Mk2":1,"weapons.missiles.AGM_65K":1,"weapons.bombs.Mk_82":1},"aircraft":{}}
TBD -- I am not sure if the inventory properly impacts weight. I think it does based on the fact that the cargo itself is less than 1500 in ME