summaryrefslogtreecommitdiff
path: root/indra/newview/scripts/lua/require/teleport_util.lua
blob: 8a46768e546bee35a588c49653ec89f16c3a05a8 (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
26
27
28
local leap = require 'leap'

local teleport_util = {}

local teleport_pump = 'LLTeleport'
local waitfor = leap.WaitFor(0, teleport_pump)
function waitfor:filter(pump, data)
    if pump == self.name then
        return data
    end
end

function waitfor:process(data)
    teleport_util._success = data.success
    leap.WaitFor.process(self, data)
end

leap.request(leap.cmdpump(),
             {op='listen', source=teleport_pump, listener='teleport.lua', tweak=true})

function teleport_util.wait()
    while teleport_util._success == nil do
      local item = waitfor:wait()
    end
    return teleport_util._success
end

return teleport_util