Sorry if this is off topic but it's for SciTE. I am very new to lua so please bear with me. I have lua functions writing the bookmarks to a file and reading it back in and setting the bookmarks. So far, so good. Since SciTE writes a *.ses file I want to read it in and append the bookmark line numbers to the end of each line in the *.ses file. This will save keeping track of yet another file. Will this mess up the *.ses files?

Is this a good idea? Or do I just need to write a separate bookmark file?

Now to my question.

I have the following function reading a file with 9 lines in it.

function read_session()
  local ln = 0
  local n  = 1
  local bufferpath = props['FilePath']
  local f = io.open("SciTE.ses", "r")
  if not f then return nil end
  for ln in f:lines() do
    local s=f:read"*l"  <--
    print (n)
    n=n+1
  end
  f:close()
  return true
end

If I comment out the line marked above, I get a count of 9 lines which is correct. Otherwise, I get a count of 5 lines.

What am I doing wrong?

Sorry for the long post!

--
Doyle Whisenant
http://www.freewebs.com/mekdesign/
"mechanic" at "sonet" dot "net"

_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to