blob: de57484bcdbefe8793d54166de2f55af96e13621 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
inspect = require 'inspect'
LLInventory = require 'LLInventory'
-- Get 'My Landmarks' folder id (you can see all folder types via LLInventory.getFolderTypeNames())
my_landmarks_id = LLInventory.getBasicFolderID('landmark')
-- Get 3 landmarks from the 'My Landmarks' folder (you can see all folder types via LLInventory.getAssetTypeNames())
landmarks = LLInventory.collectDescendentsIf{folder_id=my_landmarks_id, type="landmark", limit=3}
for _, landmark in pairs(landmarks.items) do
print(landmark.name)
end
-- Get 'Calling Cards' folder id
calling_cards_id = LLInventory.getBasicFolderID('callcard')
-- Get all items located directly in 'Calling Cards' folder
calling_cards = LLInventory.getDirectDescendents(calling_cards_id).items
-- Print a random calling card name from 'Calling Cards' folder
-- (because getDirectDescendents().items is a Lua result set, selecting
-- a random entry only fetches one slice containing that entry)
math.randomseed(os.time())
for i = 1, 5 do
pick = math.random(#calling_cards)
print(`Random calling card (#{pick} of {#calling_cards}): {calling_cards[pick].name}`)
end
|