[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: SLB vs LuaBind
- From: HyperHacker <hyperhacker@...>
- Date: Wed, 5 Jan 2011 15:03:16 -0700
On Wed, Jan 5, 2011 at 14:46, Tim Mensch <firstname.lastname@example.org> wrote:
> On 1/5/2011 8:49 AM, Jose Luis Hidalgo wrote:
>> I've been trying to see how to deal with registering accessors, and
>> the problem I see is how you would use the accessors from lua. For
>> example, if you register an accessor (a def_readwrite to a variable
>> foo of a class bar) in lua:
>> b = bar()
>> b:foo = 5
> That's not legal Lua, AFAIK. b:foo expects function arguments.
> Ideally it would actually work like this:
> b.foo = 5;
> That's how it works in, e.g., tolua++ and LuaBind. In fact you can not
> only register accessors to public data, you can register an accessor
> that calls existing accessors on a C++ class, so the code above could be
> calling the C++ member functions bar::setFoo() and bar::getFoo().
> And you can still add new members to extend b:
> b.somenewmember = 5
> I had to dig through tolua++ to fix how that worked WRT
> shared_ptr-wrapped objects, so I happen to know how it's done in at
> least tolua++; if you're curious I can explain, but there are several
> options in Lua.
> SLB not having these features was a deal killer for me, so beo wulf
> isn't the only person who considers them important. :)
Apparently WoW lets you do things like:
f = foo:bar
I'm not sure how this works, as it's not allowed in standard Lua...
Sent from my toaster.