lua-users home
lua-l archive

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


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

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).

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.

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.