blob: 107b0791d4376e6d2e3dc8dbd3bc91927ae8c671 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
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}
print(inspect(landmarks))
-- 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
local card_names = {}
for _, value in pairs(calling_cards) do
table.insert(card_names, value.name)
end
math.randomseed(os.time())
print("Random calling card: " .. inspect(card_names[math.random(#card_names)]))
|