lua-users home
lua-l archive

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

Hi Tim,

   You're right with the syntax, sorry, that's what I meant. And about
SLB's missing features I would really appreciate an email telling me
so, that's the only way I can improve SLB for others apart from me.

And for the requested feature of properties/accessors, I would
definitely look at it and see what we can do for it. I will need at
least a couple of days.


On Wed, Jan 5, 2011 at 10:46 PM, Tim Mensch <> 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
>> print(b:foo)
> That's not legal Lua, AFAIK. b:foo expects function arguments.
> Ideally it would actually work like this:
> b=bar();
> = 5;
> print(;
> 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. :)
> Tim

  Jose L. Hidalgo Valiño (PpluX)
  ---- ----