diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-09-04 07:43:48 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-09-04 07:43:48 -0400 |
commit | 35c3f0227c334e059abdc36c36cc942a517d92ec (patch) | |
tree | 48240c22f6895c330f0cc400d0dd47190419d8a1 /indra/newview | |
parent | a8dd7135f0423384dbbb1e3b98514149c6a69e6b (diff) |
Instead of traversing all calling cards, pick a selected few.
Make test_LLInventory.lua directly select from the calling_cards result set,
instead of first copying all names to a separate array.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/scripts/lua/test_LLInventory.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/indra/newview/scripts/lua/test_LLInventory.lua b/indra/newview/scripts/lua/test_LLInventory.lua index 918ca56a2e..de57484bcd 100644 --- a/indra/newview/scripts/lua/test_LLInventory.lua +++ b/indra/newview/scripts/lua/test_LLInventory.lua @@ -15,9 +15,10 @@ calling_cards_id = LLInventory.getBasicFolderID('callcard') 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 +-- (because getDirectDescendents().items is a Lua result set, selecting +-- a random entry only fetches one slice containing that entry) math.randomseed(os.time()) -print("Random calling card: " .. inspect(card_names[math.random(#card_names)])) +for i = 1, 5 do + pick = math.random(#calling_cards) + print(`Random calling card (#{pick} of {#calling_cards}): {calling_cards[pick].name}`) +end |