lotrointerface.com
Search Downloads

LoTROInterface SVN SortPack

[/] [branches/] [Hazado/] [functions.LUA] - Rev 45

Compare with Previous | Blame | View Log

--Window creator. Tides up the syntax on create   
MakeWindow = class(Turbine.UI.Window);

                function MakeWindow:Constructor(x,y,width,height,visible,colour,opacity)
                        Turbine.UI.Window.Constructor( self )
                        self :SetPosition( x,y);
                        self :SetSize(width,height );
                        self :SetVisible( visible );
                        self :SetBackColor(colour);
                        self :SetOpacity(opacity); 
                end

function SearchTable(InputTable,SearchString)
--Will search the string for given results in a table. If found returns the row reference. So, for example I could look for "ore" in any items name. Used below.
--BE AWARE! CASE SENSITIVE!
        local found
        local temp=0
        --Check for a null item and return
        if SearchString==0 then return 0 end
        
        for i = 1, # InputTable do
                
                if SearchString==InputTable[i] then  return i end --First check for an exact match
                
                --Now check for partial matches.
                found,foo=string.find(SearchString,InputTable[i],0,true)
                
                if found ~=nil then
                        temp= i
                end
        end
        --if temp==0 then Turbine.Shell.WriteLine("Failed to find..."..SearchString) end
        return temp
end

function checker()
        --will 'print' the information chosen below for the pack. Way of ensuring the order is what you are after.
        local player = Turbine.Gameplay.LocalPlayer.GetInstance();      --Define player to be the player
        local backpack = player:GetBackpack();                                  --Players backpack object
        local size =backpack:GetSize()                                                          --How big it is
        for i = 1, size do
        item = backpack:GetItem(i);
                if item ~= nil then
                        Turbine.Shell.WriteLine(item:GetName().." is "..item:GetQuality())
                end
        end
end

function mergetable(table1,list)
--Appends tables from list on the end of table1
for i=1,#list do
        table2=list[i]
                local LenTable1=#table1
                for a =LenTable1+1,#table1+#table2 do
                        table1[a]=table2[a-LenTable1]
                end
end
end

Compare with Previous | Blame


All times are GMT -5. The time now is 11:27 AM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui