lua-users home
lua-l archive

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


Responses inline.

On 10/19/12 7:53 AM, Dirk Laurie wrote:
> 2012/10/18 Rob Hoelz <rob@hoelz.ro>:
>
>>> https://github.com/downloads/hoelzro/lua-repl/lua-repl-0.3.tar.gz
>>>
>>> Please try it out and let me know what you think!
>>>
>> For those of you who don't know, lua-repl is a library for embedding a
>> Lua REPL (read-eval-print-loop) within another program.  It also
>> includes an example application named rep.lua, which is an alternative
>> to the standalone interpreter shipped with Lua itself.
>>
> I untarred the tarball and changed to its directory, did
> "sudo luarocks make luarepl-0.3-1.rockspec"  and tried "./rep.lua".
>
> It worked after the following tweaks.
>
> 1. Change the first line in rep.lua from
>     #!/usr/bin/env lua
> to
>     #!/usr/bin/env lua5.1

What OS are you? If Linux (which is my educated guess), which distro? 
Does lua exist as an
executable, or do you only have lua5.1/lua5.2/etc?
>
> 2. Symbolically link $PWD/repl to /usr/local/lib/lua/5.1 (the rock
> installs only /usr/local/lib/luarocks/rocks/luarepl/0.3-1/bin/rep.lua).
If you set up your PATH to point to wherever luarocks installs binaries
(mine is ~/.luarocks/bin),
you shouldn't need to do this.
>
> README.md says I need Luadoc (which also still seems to
> be 5.1 only) to build the documentation. No problem, all Luadoc
> does is read the source, I can do that too.
>
> The main differences I noticed is:
>
> -   rep.lua prints a lone expression without needing '=' in front.
> -   the lua5.1 interpreter supports readline, but the io library
>     does not. (My 5.1 is the one that comes with Ubuntu 12.04).
>     Therefore rep.lua also does not support readline on my
>     installation.
If you install lua-linenoise, the linenoise plugin will automatically be
loaded, and you will gain history (persistent history, even!), and tab
completion.
I should probably document this; I should also try writing a plugin that
uses rlwrap or something.
>
> The source code makes it obvious that if all you are going to
> do with lua-repl is to run rep.lua, you are missing the point.
> rep.lua is just a bare-bones demo of license plus ten lines
> of code showing how to call the library.
>
While rep.lua isn't the whole point of the library, I have switched to
using it
full time since the latest release.  The linenoise plugin combined with
the history and completion plugins
makes using it quite handy. =)

-Rob