[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Lua::API 0.04 - Perl interface to Lua’s embedding API
- From: Diab Jerius <dj@...>
- Date: Tue, 19 Apr 2011 09:44:32 -0400
On Mon, 2011-04-18 at 22:35 -0400, David Manura wrote:
> On Mon, Apr 18, 2011 at 8:41 PM, Diab Jerius <dj@head.cfa.harvard.edu>
> wrote:
> > Lua::API provides Perl bindings to Lua's C-based embedding API [...]
> > http://search.cpan.org/~djerius/Lua-API-0.04/
>
> Thanks for sharing.
>
> I didn't truly grasp the module until seeing lua.pl [1], so you might add
> some very abbreviated version of that to the documentation's Synopsis.
>
> > It allows Perl routines to be called from Lua as if they were written in
> > C, and allows Perl routines to directly manipulate the Lua interpreter
> > and its environment.
>
> One important point is that your project is a Perl module that loads into
> a Perl interpreter. It is not a Lua module that loads into a Lua
> interpreter. That is, there is no "luaopen_perlapi", as is the case in
> perlembed [2]. ([2] could also be mentioned in your comparison/see-also
> section.)
>
Good points. I'll clarify the description. I wasn't aware of the
perlembed project, thanks for pointing it out.
> This change fixes '=' handling in lua.pl:
>
> @@ -275,7 +275,7 @@
>
> if ( $firstline && substr($b, 0, 1 ) eq '=') # first line starts
> with `=' ?
> {
> - $L->pushfstring( "return %s", substr($b,1)); # change it to `return' +
> $L->pushfstring( "return %s", $b+1); # change it to `return'
> }
Thanks.
> To avoid a symbol-not-found error on Ubuntu, I had to build with the
> suggested
>
> perl Makefile.PL LUA_INC=-I/usr/include/lua5.1 LUA_LIBS='-llua5.1'
Which version of ubuntu? Could you send me the error? I'll try to fix
that.
> It might be nice if lua.pl had some way for the end-user to embed Perl
> code from the interpreter, maybe by exposing some Lua function that
> converts a Perl string to a Lua function.
I'll add additional examples; I prefer keeping as lua.pl as close to a
direct translation of lua.c as possible to serve as an educational
device.
> [1] http://cpansearch.perl.org/src/DJERIUS/Lua-API-0.04/examples/lua.pl
> [2] http://thomaslauer.com/comp/Calling_Perl_from_Lua