diff options
-rwxr-xr-x | telem.lua | 19 |
1 files changed, 8 insertions, 11 deletions
@@ -209,24 +209,21 @@ end function do_type_first() current_thread_index = 1 - do_type_show_post(current_thread_index) - print(string.format("Viewing post %d of %d in thread", current_thread_index, #current_thread_posts)) + do_type_show_post() end function do_type_next() if current_thread_index ~= #current_thread_posts then current_thread_index = current_thread_index + 1 end - do_type_show_post(current_thread_index) - print(string.format("Viewing post %d of %d in thread", current_thread_index, #current_thread_posts)) + do_type_show_post() end function do_type_prev() if current_thread_index ~= 1 then current_thread_index = current_thread_index - 1 end - do_type_show_post(current_thread_index) - print(string.format("Viewing post %d of %d in thread", current_thread_index, #current_thread_posts)) + do_type_show_post() end function do_type_reply() @@ -241,7 +238,7 @@ function do_type_reply() end current_thread_posts = get_posts(thread) current_thread_index = #current_thread_posts - do_type_show_post(current_thread_index) + do_type_show_post() end type_dispatch = {} @@ -262,8 +259,7 @@ function do_type() current_thread_subject = thread.subject current_thread_posts = get_posts(thread) current_thread_index = #current_thread_posts - do_type_show_post(current_thread_index) - print(string.format("Viewing post %d of %d in thread", current_thread_index, #current_thread_posts)) + do_type_show_post() repeat show_type_prompt() c = getchar() @@ -280,14 +276,15 @@ function show_type_prompt() io.write("[f]irst, [n]ext, [p]rev, [r]eply, [d]one > ") end -function do_type_show_post(index) - local post = current_thread_posts[index] +function do_type_show_post() + local post = current_thread_posts[current_thread_index] print("SUBJECT: " .. current_thread_subject) print("AUTHOR: " .. post.author) print("POSTED: " .. os.date("%H:%M %B %d, %Y", post.timestamp)) print("--------------------------------") cat_file(post.filename) print("--------------------------------") + print(string.format("Viewing post %d of %d in thread", current_thread_index, #current_thread_posts)) end function do_quit() |