View Single Post
  #2  
Unread 12-09-2010, 01:33 AM
MrJackdaw's Avatar
MrJackdaw MrJackdaw is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Feb 2009
Location: Lancaster, England
Posts: 249
Code:
--Returns a table of the shortcuts in the quickslots.
function StoreSlots(self)
		destination={}
		for i = 1,#self do
			local shortcut=self[i]:GetShortcut()
			destination[i]={}
			destination[i].Data=shortcut:GetData()
			destination[i].Type=shortcut:GetType()
		end
		return destination
end

--Load shortcuts from the source table.
function LoadSlots(self,source)
	for i=1,#self do
	if source~=nil then PSetShortcut(self[i],Turbine.UI.Lotro.Shortcut( source[i].Type,source[i].Data )) end
	end
end
This (1) loads the shortcuts from a table of quickslots. (2) sets the shortcuts in a table of quickslots!

To use, lets say you had a table of quickslots called Geoff and wanted to store the shortcuts in a table called GeoffStore;

Code:
GeoffStore=StoreSlots(Geoff)
To load again;

Code:
LoadSlots(Geoff,GeoffStore)
NB: This is a slightly modified version of what is in the library for bevyobars - have a look if you like. This may not be the most elegant way of doing it, but it works for me! Also, as it is modified I ain't tested it...
__________________
************************************************** ************************************************** **
"Our ideals may never be realised, But they indicate what we are trying to do." Dick Tahta
Reply With Quote