Murga-Projects Forums
ebooks - Printable Version

+- Murga-Projects Forums (http://www.murga-projects.com/forum)
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: ebooks (/showthread.php?tid=62)


ebooks - spencerhfuchs - 06-27-2007 10:29 PM

I am a co-author on an open source multi-platform ebook reader. And I'm new to the whole writing code scene. Murgalua is the one that has made the most sense yet.

We have made the read_in read chunk 10k for the purpose of speed, but by doing this we have made it more difficult to write the previous_set function.


Quote:
function previous_set()
if fetch == nil then
fetch = 1
else
fetch = fetch - 1
end
print(fetch)
block = read_in(book_file)
local jo = do_justify(cur_pages[page_now - 1] .. block, 35)
local num_lines, num_pages, lines, bbp, p = pages(jo)
cur_pages = p
page_now = 0
total_pages =#p
end



When you go back tho it goes into negatives on the pages(shows a blank page after it has ran the buffer out) versus pulls the previous 10k chunk.

Is there any easier way to do this?


RE: ebooks - JohnMurga - 06-28-2007 06:11 PM

Hi

I would have though it was a question of changing :

Code:
if fetch == nil then


For :

Code:
if fetch == nil or fetch < 1 then


Unless I am missing something ?

Cheers
JohnM