AFRLme

Organize items alphabetically (asc) [vs]

Feb 10th, 2014
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. --[[
  2. Organize Items Alphabetically (v1) [10/02/2014]
  3. By AFRLme
  4. -- + --
  5. [email protected] | skype @ AFRLme
  6. --]]
  7.  
  8. local char, items -- empty variables
  9. local sort_func = function( a,b ) return a:getName() < b:getName() end -- sort function (ascending A-Z, 1-10 etc)
  10.  
  11. function arrangeItems()
  12.  char = game:getLink(VGameCurrentCharacter) -- store current character
  13.  items = char:getLinks(VCharacterItems) -- store items
  14.  table.sort(items, sort_func) -- sort the items alphabetically
  15.  char:setValue(VCharacterItems, items) -- amend new item order to the inventory
  16. end
Advertisement
Add Comment
Please, Sign In to add comment