Yet another rewrite! For compatibility with old layouts of version 2.0.5 and older, you have to add local cargoShip = LibStub("LibCargoShip-2.1") to the top of your file!.
cargoShip is a LibDataBroker display-addon and library which can only be configured through changing the Lua-code. It was designed to provide a lightweight and flexible framework for creating info blocks based on data objects.
It provides support for the following attributes (you can add more if you like):
- icon, iconR, iconB, iconG, iconCoords
- text, label, value, suffix
- OnEnter, OnLeave, OnClick
- tooltip, OnTooltipShow
You can add more of them (or change existing) by providing your custom functions in cargoShip.UpdateFunctions["attributeName"] = function(self, attribute, dataobj) end.
The addon comes with a sample layout which gives you a good start on creating and positioning your elements (in the layout.lua - with comments). Please note that I most likely use different LDB-data sources than you do
A short function reference (the complete one is on
my GitHub repo):
- block = cargoShip("name" [, options]) - returns a new info block of the specified LDB-data source
- block = cargoShip(options) - returns a new info block of the specified LDB-data source in options.name
- blocks = cargoShip:Get(dataObject) - returns a table of all created blocks for this data source
- block = cargoShip:GetFirst(dataObject) - returns a table of all created blocks for this data source
- cargoShip:GetUnused(verbose) - returns a table of all unused data sources, and optionally prints it to chat
- block:SetDataObject(dataObject) - set a new data source for the block
Please drop a comment for your feedback, bug reports and/or suggestions.