diff options
Diffstat (limited to 'indra/newview/scripts')
-rw-r--r-- | indra/newview/scripts/lua/LLDebugSettings.lua | 7 | ||||
-rw-r--r-- | indra/newview/scripts/lua/UI.lua | 5 | ||||
-rw-r--r-- | indra/newview/scripts/lua/leap.lua | 12 | ||||
-rw-r--r-- | indra/newview/scripts/lua/util.lua | 7 |
4 files changed, 13 insertions, 18 deletions
diff --git a/indra/newview/scripts/lua/LLDebugSettings.lua b/indra/newview/scripts/lua/LLDebugSettings.lua index 06a8a63727..c250019a00 100644 --- a/indra/newview/scripts/lua/LLDebugSettings.lua +++ b/indra/newview/scripts/lua/LLDebugSettings.lua @@ -1,18 +1,17 @@ leap = require 'leap' -util = require 'util' local LLDebugSettings = {} function LLDebugSettings.set(name, value) - util.check_response(leap.request('LLViewerControl', {op='set', group='Global', key=name, value=value})) + leap.request('LLViewerControl', {op='set', group='Global', key=name, value=value}) end function LLDebugSettings.toggle(name) - util.check_response(leap.request('LLViewerControl', {op='toggle', group='Global', key=name})) + leap.request('LLViewerControl', {op='toggle', group='Global', key=name}) end function LLDebugSettings.get(name) - return util.check_response(leap.request('LLViewerControl', {op='get', group='Global', key=name}))['value'] + return leap.request('LLViewerControl', {op='get', group='Global', key=name})['value'] end return LLDebugSettings diff --git a/indra/newview/scripts/lua/UI.lua b/indra/newview/scripts/lua/UI.lua index 6101c7a312..24f822bbd9 100644 --- a/indra/newview/scripts/lua/UI.lua +++ b/indra/newview/scripts/lua/UI.lua @@ -1,17 +1,16 @@ -- Engage the UI LLEventAPI leap = require 'leap' -util = require 'util' local UI = {} function UI.call(func, parameter) -- 'call' is fire-and-forget - util.check_response(leap.request('UI', {op='call', ['function']=func, parameter=parameter})) + leap.request('UI', {op='call', ['function']=func, parameter=parameter}) end function UI.getValue(path) - return util.check_response(leap.request('UI', {op='getValue', path=path}))['value'] + return leap.request('UI', {op='getValue', path=path})['value'] end return UI diff --git a/indra/newview/scripts/lua/leap.lua b/indra/newview/scripts/lua/leap.lua index ade91789f0..cfb7377523 100644 --- a/indra/newview/scripts/lua/leap.lua +++ b/indra/newview/scripts/lua/leap.lua @@ -161,10 +161,12 @@ function leap.request(pump, data) dbg('leap.request(%s, %s) got %s: %s', pump, data, ok, response) -- kill off temporary WaitForReqid object, even if error pending[reqid] = nil - if ok then - return response - else + if not ok then error(response) + elseif response.error then + error(response.error) + else + return response end end @@ -186,7 +188,7 @@ function leap.generate(pump, data, checklast) local ok, response, resumed_with repeat ok, response = pcall(waitfor.wait, waitfor) - if not ok then + if (not ok) or response.error then break end -- can resume(false) to terminate generate() and clean up @@ -196,6 +198,8 @@ function leap.generate(pump, data, checklast) pending[reqid] = nil if not ok then error(response) + elseif response.error then + error(response.error) end end diff --git a/indra/newview/scripts/lua/util.lua b/indra/newview/scripts/lua/util.lua index 404efdf09e..a2191288f6 100644 --- a/indra/newview/scripts/lua/util.lua +++ b/indra/newview/scripts/lua/util.lua @@ -41,11 +41,4 @@ function util.equal(t1, t2) return util.empty(temp) end -function util.check_response(res) - if res.error then - error(res.error) - end - return res -end - return util |