[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua vs Python C bindings
- From: v <v19930312@...>
- Date: Sun, 23 Jun 2019 03:12:31 +0300
On Sun, 2019-06-23 at 00:39 +0100, Dibyendu Majumdar wrote:
> Recently I started created a Python binding for one of my projects. I
> already had Ravi/Lua bindings hand-coded in C++/C.
What I know is tool tolua. Its fork is used in cocos2d-x framework to
make Lua bindings, that's where I know it from.
However, it seems to don't maintained anymore, and last version is for
Lua 5.1/5.2.
I'm also pretty sure that there are some other tools, but most of them
seem to be unmaintained as well.
> It seems like creating a Cython clone for Lua might be a good
> idea.
Indeed it is! Sounds like tedious work, though.
P.S.: I'm working on Lua/C++ bridge now, but I'm aiming at embedded Lua
usage case and not standalone, but you may run any Lua script with it
anyways, so making standalone version shouldn't be too hard.
However, it still require some modifications to code (and more
significant ones if you want advanced stuff like Lua-specific
constructions and metamethods). Simple example, adding method to Lua
look like
const Lua::MethodsTable<MyTestClass> MyTestClass::methods = {
{"TestMethod", Lua::CppMethodWrapper<MyTestClass, Lua::Number,
std::string>(&MyTestClass::TestMethod)}
};
While this looks kinda messy (so far), it allows you to avoid code
generation.
--
v <v19930312@gmail.com>