lua-users home
lua-l archive

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

(1) I fully agree with all corrections Tim has made concerning my examples.
(2) Are there any other deal breakers for anyone else?

I feel that if I can bind functions, and I can bind variables, then
that's about all I need. The fact function binding works -- implies
that variable passing / sticking them into pointers has all been taken
care of.

The issue concerning binding variables .. seems like one that can be
best (only?) resolved via metatable __index and __new_index to SLB can
do the right thing when an assignment/read happens in lua.

Anyone else have thoughts/suggestions/insights on binding variables
(either how it can be done in SLB, or how it has been done in

On Wed, Jan 5, 2011 at 1: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