Usage


<MyMod>.toc file

...
## OptionalDeps: ..., LibPeriodicTable-3.1, ...
## X-Embeds: ..., LibPeriodicTable-3.1, ...
...
# Libraries
embeds.xml
...



embeds.xml

  • Include LibPeriodicTable-3.1
  • Include 1 or more of the split up files like LibPeriodicTable-3.1-Consumable
<Ui xmlns="http://www.blizzard.com/wow/ui/">
	<Script file="libs\LibStub\LibStub.lua"/>
	<Script file="libs\CallBackHandler-1.0\CallbackHandler-1.0.lua"/>
...
	<Script file="libs\LibPeriodicTable-3.1\LibPeriodicTable-3.1.lua"/>
	<Script file="libs\LibPeriodicTable-3.1-Consumable\LibPeriodicTable-3.1-Consumable.lua"/>
...
</Ui>



<MyMod>.lua

  • Use LibStub to get the most up to date version of LibPeriodicTable
  • Use the LibPeriodicTable API functions
local PT = LibStub("LibPeriodicTable-3.1")
...
-- Add items from set to rawList
function MyMod:RawItemsAdd(rawList, set, priority)
	if (not rawList) then
		rawList = {}
	end
	if (set) then
		local cacheSet = PT:GetSetTable(set)
		if (cacheSet) then
			local index = # rawList + 1
			for itemId, value in PT:IterateSet(set) do
				if (not value or type(value) == "boolean") then
					value = 0;
				end
				value = tonumber(value)
				rawList[index] = {itemId, value, priority}
				index = index + 1
			end
		else
			print("MyMod could not find the PT3.1 set ", set, ".  Make sure you have all the libraries MyMod needs to function.")
		end
	end
	return rawList
end
...
rawList = self:RawItemsAdd(rawList, "Consumable.Food.Edible.Meat.Basic", true)



.pkgmeta

package-as: <MyMod>

externals:
    libs/LibStub: svn://svn.wowace.com/wow/libstub/mainline/tags/1.0
    libs/CallbackHandler-1.0: svn://svn.wowace.com/wow/callbackhandler/mainline/tags/1.0.3/CallbackHandler-1.0
...
    libs/LibPeriodicTable-3.1: svn://svn.wowace.com/wow/libperiodictable-3-1/mainline/trunk/LibPeriodicTable-3.1
    libs/LibPeriodicTable-3.1-Consumable: svn://svn.wowace.com/wow/libperiodictable-3-1/mainline/trunk/LibPeriodicTable-3.1-Consumable

Comments

Posts Quoted:
Reply
Clear All Quotes