lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I've looked into fixing most of these. The implementation is ready but I haven't pushed anything yet.

On 06/15/2015 08:38 PM, Brigham Toskin wrote:
On Sun, Jun 14, 2015 at 9:05 PM, Daurnimator <quae@daurnimator.com
<mailto:quae@daurnimator.com>> wrote:

       - How is it recommended to install luaprompt for different lua
    versions side by side?
         i.e. How can I switch between 5.1 and 5.3?

I had to build luarocks from source for the different versions of lua on
my system, using the configure options, e.g.:

     ./configure  --lua-version=5.1 --versioned-rocks-dir

will configure the build for lua 5.1 (and luajit), and will sequester
the rocks config files under a 5.1 subdirectories. That second one is
necessary because when you also do 5.2 and/or 5.3, you don't want the
different versions clobbering each other's data. Then you make and
install as usual according to the instructions.

The problem here is that the all versions will install the standalone interpreter under /usr/local/bin/luap, or whatever the configured prefix is, each one overwriting the previous.

There's no graceful way to handle this with LuaRocks as far as I can tell. One solution is to have a separate rockfile for each version (I implemented and submitted a patch for version-specific overrides similar to platform overrides, but it won't make it into LuaRocks until the next major version, if then, due to compatibility concerns). Each rockfile can then install two versions of the standalone script, one under the name luap-5.2, say, and one under luap. The plain luap file will be overwritten, but the versioned file will still be available.

In addition to the rockfile duplication, which is no major issue, this has the effect that the same file will be installed multiple times, instead of the usual practice of using symlinks. I dislike that, but I can't think of another way.

       - Why do I need to press Ctrl+C twice to exit?


What OS are you on? For Linux, OS X, and other Unices, use Ctrl+D
instead. On Windows, I think it might be Ctrl+Z if you're in cmd or
powershell?


Ctrl-D can indeed be used to quit the prompt, but the double Ctrl-C behavior is still erratic. This happened when luap became a lua script instead of being a binary. The Lua interpreter installs a signal handler for Ctrl-C, so that one can interrupt long-running commands and it interferes with luap.

I've implemented a fix, which provides the usual behavior where Ctrl-C cancels the currently edited line and starts a fresh one. When not editing a line, Ctrl-C can still be used to interrupt a long-running command. One should still use Ctrl-D to quit.

       - Could you do rotating tab completion instead of only to the prefix?
         i.e. pr<tab> might complete to 'prompt', but pressing <tab> again
    would change to 'print'

See my other reply in regard to the above.

D.