diff options
| author | Alexander Gavrilov | 2012-06-24 12:51:19 +0400 |
|---|---|---|
| committer | Alexander Gavrilov | 2012-06-24 12:51:19 +0400 |
| commit | 9046fed648376d53071773fb3b7fbcf569a3ae59 (patch) | |
| tree | 706d9222701f337d9acbfb00388d20353bb855a0 /library/lua | |
| parent | 59fb4daa9a366a8f6da879108cd7cee5c2aa0b71 (diff) | |
| download | dfhack-9046fed648376d53071773fb3b7fbcf569a3ae59.tar.gz dfhack-9046fed648376d53071773fb3b7fbcf569a3ae59.tar.bz2 dfhack-9046fed648376d53071773fb3b7fbcf569a3ae59.tar.xz | |
Add documentation for some utility functions implemented in lua.
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 |
