lua-users home
lua-l archive

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


Sorry for the top post. A response from my request on the swig mailing list about swig 4 and lua 5.3.5:

"For the Plplot project, the combination of swig-4.0.0 and Lua 5.3.5
works fine for me on Linux where I built both because my Linux
distribution (Debian Testing) does not currently supply either one.
However, another PLplot developer has reported that Lua 5.3.5 supplied
by the MinGW-w64/MSYS2 Windows platform is just plain broken right now
(independent of swig). So at least recent lua version reliability can
vary with platform so it is a matter of "try and see".

Alan"

Russ

Sent from my BlackBerry 10 smartphone on the Virgin Mobile network.
  Original Message  
From: Coda Highland
Sent: Saturday, June 22, 2019 5:31 PM
To: Lua mailing list
Reply To: Lua mailing list
Subject: Re: Lua vs Python C bindings



On Sat, Jun 22, 2019 at 6:39 PM Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
Recently I started created a Python binding for one of my projects. I
already had Ravi/Lua bindings hand-coded in C++/C.

With regards to the C api of Python vs Lua there is no contest. The
Python C api is much more verbose and hence writing a binding in that
is a big task.

But what surprised me is a tool called Cython.

It accepts an extended Python syntax, where you can statically declare
C and C++ types, and then use them in the Python code. Then you run
the Cython compiler and it generates C or C++ code and that's it.
Basically you write Python like high level language most of the time,
and everything else is taken care of. Ref counting, type checking, all
taken care of.

Amazingly it works with C++ too as my project is in C++. No need to
write C wrappers.

So it seems that writing a C/C++ binding for Python is actually less
effort than writing one for Lua.

It seems like creating a Cython clone for Lua might be a good idea.
Maybe someone is already doing this?

Regards
Dibyendu


SWIG has a lot of different targets available. Lua is among them but I don't know what versions of Lua it supports.

/s/ Adam