[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Advice needed for a Lua <-> Vim bridge library
- From: Alex Bradbury <asb@...>
- Date: Wed, 14 Sep 2011 22:26:46 +0100
On 14 September 2011 21:22, Rob Hoelz <firstname.lastname@example.org> wrote:
> - Assigning booleans to Vim variables will coerce them to Vim numbers,
> but no coercion will take place on the way back. We'll need to use
> constructs like if w.my_variable ~= 0 then ... end or if
> toboolean(w.my_variable) then ... end. However, Vim functions that
> are known to return boolean values can coerce their outputs to
> boolean, so we can still do if haslocaldir() then ... end.
It's possible that if I devoted time to trying to write a script using
this system I'd come to a different conclusion, but my instinct is to
prefer the solution above. It's the least surprising and the simplest.
Sure, the conversion between Lua and vimscript is lossy, but at least
it's easy to understand.