diff options
| author | jj | 2012-07-06 20:37:14 +0200 |
|---|---|---|
| committer | jj | 2012-07-06 20:37:14 +0200 |
| commit | c20951c30bd089da4a6d348265a851bc577e7fc3 (patch) | |
| tree | 4bbe54351d9fb24b073ad008b8ce2195a6912112 /library/lua | |
| parent | 028b47a3213ef951690a1006dc7f9ad60f03917f (diff) | |
| parent | 4bbb185f7ba546fbab44e275fa243abb764e7571 (diff) | |
| download | dfhack-c20951c30bd089da4a6d348265a851bc577e7fc3.tar.gz dfhack-c20951c30bd089da4a6d348265a851bc577e7fc3.tar.bz2 dfhack-c20951c30bd089da4a6d348265a851bc577e7fc3.tar.xz | |
Merge branch 'master' of git://github.com/angavrilov/dfhack
Diffstat (limited to 'library/lua')
| -rw-r--r-- | library/lua/utils.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/library/lua/utils.lua b/library/lua/utils.lua index f303091d..38a1e6c4 100644 --- a/library/lua/utils.lua +++ b/library/lua/utils.lua @@ -57,10 +57,10 @@ function is_container(obj) end -- Make a sequence of numbers in 1..size -function make_index_sequence(size) +function make_index_sequence(istart,iend) local index = {} - for i=1,size do - index[i] = i + for i=istart,iend do + index[i-istart+1] = i end return index end @@ -114,7 +114,7 @@ function make_sort_order(data,ordering) end -- Make an order table - local index = make_index_sequence(size) + local index = make_index_sequence(1,size) -- Sort the ordering table table.sort(index, function(ia,ib) @@ -379,7 +379,7 @@ function prompt_yes_no(msg,default) elseif string.match(rv,'^[Nn]') then return false elseif rv == 'abort' then - qerror('User abort in utils.prompt_yes_no()') + qerror('User abort') elseif rv == '' and default ~= nil then return default end @@ -393,7 +393,7 @@ function prompt_input(prompt,check,quit_str) while true do local rv = dfhack.lineedit(prompt) if rv == quit_str then - return nil + qerror('User abort') end local rtbl = table.pack(check(rv)) if rtbl[1] then |
