diff options
| author | Alexander Gavrilov | 2012-06-22 16:36:50 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-06-22 16:36:50 +0400 |
| commit | 65e82f7c12f95e461363e15c781c3fd4c5d241d3 (patch) | |
| tree | 8fdf842130f38c8dbb2c6cea8fbc0e3bc013e9e9 /library/lua | |
| parent | 752da9ced5ce2df8cc9638cbf75a769325540e31 (diff) | |
| download | dfhack-65e82f7c12f95e461363e15c781c3fd4c5d241d3.tar.gz dfhack-65e82f7c12f95e461363e15c781c3fd4c5d241d3.tar.bz2 dfhack-65e82f7c12f95e461363e15c781c3fd4c5d241d3.tar.xz | |
Support controllable error presentation verbosity in lua code.
Use qerror to squash stack traces and location prefix.
Diffstat (limited to 'library/lua')
| -rw-r--r-- | library/lua/dfhack.lua | 4 | ||||
| -rw-r--r-- | library/lua/memscan.lua | 2 | ||||
| -rw-r--r-- | library/lua/utils.lua | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/library/lua/dfhack.lua b/library/lua/dfhack.lua index 4cdb4c95..d200a6c5 100644 --- a/library/lua/dfhack.lua +++ b/library/lua/dfhack.lua @@ -49,6 +49,10 @@ function dfhack.pcall(f, ...) return xpcall(f, dfhack.onerror, ...) end +function qerror(msg, level) + dfhack.error(msg, (level or 1) + 1, false) +end + function dfhack.with_finalize(...) return dfhack.call_with_finalizer(0,true,...) end diff --git a/library/lua/memscan.lua b/library/lua/memscan.lua index 92a3e3e8..970f821c 100644 --- a/library/lua/memscan.lua +++ b/library/lua/memscan.lua @@ -235,7 +235,7 @@ function found_offset(name,val) if not val then print('Could not find offset '..name) if not cval and not utils.prompt_yes_no('Continue with the script?') then - error('User quit') + qerror('User quit') end return end diff --git a/library/lua/utils.lua b/library/lua/utils.lua index 93ee840c..f303091d 100644 --- a/library/lua/utils.lua +++ b/library/lua/utils.lua @@ -379,7 +379,7 @@ function prompt_yes_no(msg,default) elseif string.match(rv,'^[Nn]') then return false elseif rv == 'abort' then - error('User abort in utils.prompt_yes_no()') + qerror('User abort in utils.prompt_yes_no()') elseif rv == '' and default ~= nil then return default end |
