summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua/test_nearby_avatars.lua
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2024-10-04 18:33:28 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2024-10-04 18:34:48 +0300
commit5836d8835f88af8b82154a48bcf1281937ed1f04 (patch)
treefdcced3cc76e78051c1829ce9003e71a5cfd6b9b /indra/newview/scripts/lua/test_nearby_avatars.lua
parente093a98f86ad46374f5067adb616a2aead73eff5 (diff)
Lua api to get info about nearby avatars and objects
Diffstat (limited to 'indra/newview/scripts/lua/test_nearby_avatars.lua')
-rw-r--r--indra/newview/scripts/lua/test_nearby_avatars.lua25
1 files changed, 25 insertions, 0 deletions
diff --git a/indra/newview/scripts/lua/test_nearby_avatars.lua b/indra/newview/scripts/lua/test_nearby_avatars.lua
new file mode 100644
index 0000000000..c7fa686076
--- /dev/null
+++ b/indra/newview/scripts/lua/test_nearby_avatars.lua
@@ -0,0 +1,25 @@
+inspect = require 'inspect'
+LLAgent = require 'LLAgent'
+
+-- Get the list of nearby avatars and print the info
+local nearby_avatars = LLAgent.getNearbyAvatarsList()
+if nearby_avatars.result.length == 0 then
+ print("No avatars nearby")
+else
+ print("Nearby avatars:")
+ for _, av in pairs(nearby_avatars.result) do
+ print(av.name ..' ID: ' .. av.id ..' Global pos:' .. inspect(av.global_pos))
+ end
+end
+
+-- Get the list of nearby objects in 3m range and print the info
+local nearby_objects = LLAgent.getNearbyObjectsList(3)
+if nearby_objects.result.length == 0 then
+ print("No objects nearby")
+else
+ print("Nearby objects:")
+ local pos={}
+ for _, obj in pairs(nearby_objects.result) do
+ print('ID: ' .. obj.id ..' Global pos:' .. inspect(obj.global_pos))
+ end
+end