summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua/test_nearby_avatars.lua
blob: c7fa686076393f463ba5078ac1256d4a8a9296aa (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
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