Saturday, January 21, 2012

Erratic behavior of Lua.

Hello there,

Suppose the following function:

fun! Test ()
let l:x = [line('.')]
echo l:x[0]
lua << endlua
local x = vim.eval("l:x")
print(">>" .. x[1])
endlua
endfun

It is admittedly not very informative, and prints "N" and then ">>N",
where N is the current line number. The problem is that it doesn't do
that always; rather ">>N" is sometimes wrong, and you end up with e.g.
"8" followed by ">>4" when you're on the 8th line.

The biggest problem, though, is that I'm completely unable to find a
pattern for the error: I can repeat moving around and calling the
function for some time and everything is fine; then it starts going
wrong (and generally doesn't stop). For instance, I've just started
Gvim, sourced the script with the function, and made some tries:
everything went fine. I opened a few files, switched to Iceweasel,
resourced the script, and it went wrong...

So: if anybody is patient enough to make random moves and call the
function, can they confirm similar behavior? Or is there any strategy
I could use to identify where the problem lies?

Best,
Paul

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: