[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: David Manura <dm.lua@...>
- Date: Mon, 18 Apr 2011 22:35:47 -0400
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.)
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'
}
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'
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.
[1] http://cpansearch.perl.org/src/DJERIUS/Lua-API-0.04/examples/lua.pl
[2] http://thomaslauer.com/comp/Calling_Perl_from_Lua