summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua/test_animation.lua
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/scripts/lua/test_animation.lua')
-rw-r--r--indra/newview/scripts/lua/test_animation.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/indra/newview/scripts/lua/test_animation.lua b/indra/newview/scripts/lua/test_animation.lua
index 37e7254a6c..ae5eabe148 100644
--- a/indra/newview/scripts/lua/test_animation.lua
+++ b/indra/newview/scripts/lua/test_animation.lua
@@ -7,8 +7,8 @@ animations_id = LLInventory.getBasicFolderID('animatn')
anims = LLInventory.collectDescendentsIf{folder_id=animations_id, type="animatn"}.items
local anim_ids = {}
-for key in pairs(anims) do
- table.insert(anim_ids, key)
+for _, key in pairs(anims) do
+ table.insert(anim_ids, {id = key.id, name = key.name})
end
if #anim_ids == 0 then
@@ -16,17 +16,17 @@ if #anim_ids == 0 then
else
-- Start playing a random animation
math.randomseed(os.time())
- local random_id = anim_ids[math.random(#anim_ids)]
- local anim_info = LLAgent.getAnimationInfo(random_id)
+ local random_anim = anim_ids[math.random(#anim_ids)]
+ local anim_info = LLAgent.getAnimationInfo(random_anim.id)
- print("Starting animation locally: " .. anims[random_id].name)
- print("Loop: " .. anim_info.is_loop .. " Joints: " .. anim_info.num_joints .. " Duration " .. tonumber(string.format("%.2f", anim_info.duration)))
- LLAgent.playAnimation{item_id=random_id}
+ print("Starting animation locally: " .. random_anim.name)
+ print("Loop: " .. tostring(anim_info.is_loop) .. " Joints: " .. anim_info.num_joints .. " Duration " .. tonumber(string.format("%.2f", anim_info.duration)))
+ LLAgent.playAnimation{item_id=random_anim.id}
-- Stop animation after 3 sec if it's looped or longer than 3 sec
- if anim_info.is_loop == 1 or anim_info.duration > 3 then
+ if anim_info.is_loop or anim_info.duration > 3 then
LL.sleep(3)
print("Stop animation.")
- LLAgent.stopAnimation(random_id)
+ LLAgent.stopAnimation(random_anim.id)
end
end