WoWInterface SVN PVPTimer

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk/EMLib
    from Rev 2 to Rev 3
    Reverse comparison

Rev 2 → Rev 3

EMLib.lua
1,5 → 1,5
--[[
EV's Mod Library by EVmaker, v0.08:
EV's Mod Library by EVmaker, v0.09:
 
After getting tired of copying often used functions (such as printing to chat) over and over after each mod I work on,
I decided to move all the most commonly used functions into a general library which I can have as a dependency for
7,7 → 7,7
]]--
 
-- Declares the locals
local EML_Version = "0.08";
local EML_Version = "0.09";
local debugMode = false;
local EML_supportedMods = {
["Looter"] = true,
150,12 → 150,41
return itemPrice;
end
 
-- Gets item tooltip information
function EML_toolInfo(arg,from)
local itemLink;
local itemArray;
if (GameTooltip:IsShown()) then
local name;
name, itemLink = GameTooltip:GetItem();
elseif (ItemRefTooltip:IsShown()) then
local name;
name, itemLink = ItemRefTooltip:GetItem();
end
if (itemLink) then
itemArray = EML_getInfo(itemLink);
end
if (itemLink) then
if (arg == "info") then
EMLChat(tostring(itemLink)..", ID: "..itemArray["ID"]..", Stack Size: "..itemArray["StackCount"],"chat",from)
else
return itemArray;
end
else
EMLChat("ID Failed.","chat",from)
return nil;
end
end
 
-- Returns GetItemInfo in a easily accessible table
function EML_getInfo(arg)
local itemArray;
local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemTexture, itemPrice = GetItemInfo(arg)
if (itemName) then
local _,itemID = EML_Parser(itemLink);
itemArray = {
["Name"] = itemName,
["ID"] = itemID,
["Link"] = itemLink,
["Rarity"] = itemRarity,
["ILevel"] = itemLevel,
177,14 → 206,20
if (what == "new") then
table.insert(where,"StartDontRemove")
else
for index,value in pairs(where) do
if (type(index) == "number") then
table.insert(where,what)
return nil;
elseif (type(index) == "string") then
where[theValue] = true
return nil;
if (type(where) == "table") then
for index,value in pairs(where) do
if (type(index) == "number") then
table.insert(where,what)
return true;
elseif (type(index) == "string") then
where[theValue] = true;
return true;
end
end
table.insert(where,what)
return true;
else
if (debugMode) then EMLChat("Not given a table.","chat","EML","red") end
end
end
end
197,10 → 232,8
end
end
for index,value in pairs(where) do
if (value == true) then
if (index == what) then
where[index]=nil;
end
if (index == what) then
where[index]=nil;
end
end
end
212,9 → 245,12
 
-- Copies a table for safe resetting or other uses
function EML_copyTable(arg)
local newTable = {};
for index,value in pairs(arg) do
newTable[index] = value;
local newTable;
if (type(arg) == "table") then
newTable = {};
for index,value in pairs(arg) do
newTable[index] = value;
end
end
return newTable;
end
230,6 → 266,8
isFound=true;
end
end
else
if (debugMode) then EMLChat("No table for FindTable","chat","EML") end
end
return isFound;
end
249,6 → 287,21
end
end
 
-- Sets a table value
function EML_setTable(what,where,to)
if (type(to) == "table") then
for index,value in pairs(to) do
if (where == index) then
to[where] = what;
elseif (where == value) then
to[index] = what
end
end
else
if (debugMode) then EMLChat("No table for SetTable","chat","EML") end
end
end
 
-- Makes sure settings are in one array from another array
function EML_mergeTable(arrayTo,arrayFrom)
local newArray;
430,6 → 483,7
return version, build, tocversion;
end
 
-- Prints or returns the current WoW zone information
function EML_zoneInfo(what,where)
local zoneName = tostring(GetZoneText());
local subZoneName = tostring(GetSubZoneText());
456,7 → 510,7
end
if (debugMode) then
for i=0, #(bagsName) do
EMLChat("Bag Name: "..tostring(bagsName[i])..", Bag Type: "..(bagsType[i])..", Bag Slots: "..tostring(bagsSlots[i])..", Free Slots: "..tostring(bagsFree[i]),"chat",where)
EMLChat("Bag Name: "..tostring(bagsName[i])..", Bag Type: "..tostring(bagsType[i])..", Bag Slots: "..tostring(bagsSlots[i])..", Free Slots: "..tostring(bagsFree[i]),"chat",where)
end
end
return bagsName,bagsType,bagsSlots,bagsFree;
EMLib.toc
1,4 → 1,4
## Interface: 30100
## Interface: 30200
## Title: EMLib
## Notes: EV's Mod Library, contains commonly used functions across his mods.
## Author: EVmaker