[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Another userdata question
- From: Andrew Starks <andrew.starks@...>
- Date: Sat, 16 Nov 2013 15:56:11 -0600
Actually, there is a missing chunk, which may already be obvious...
Your user needs to be able to set the functions.
So, when they have the userdata (or as part of its constructor), you
need to set the index metamethod to retrieve the `callbackfunctions`
table, when they ask for it:
```
mybtn.callbackfunctions.action = function() end
```
to do this, in C, just make your __index function retrieve the
uservalue from the userdata (which will automatically be at index 1 on
the stack) and return the callbackfunctions table from the uservalue
table.
---Andrew
On Sat, Nov 16, 2013 at 3:52 PM, Andrew Starks <andrew.starks@trms.com> wrote:
> On Sat, Nov 16, 2013 at 3:52 PM, Andrew Starks <andrew.starks@trms.com> wrote:
>> lua_setuservalue(L, 8); //position 8 is where your user value was.
>
> Sorry this should read:
>
> lua_setuservalue(L, 8); //position 8 is where your userdata was.
- References:
- Another userdata question, Geoff Smith
- Re: Another userdata question, Peng Zhicheng
- RE: Another userdata question, Geoff Smith
- RE: Another userdata question, Geoff Smith
- Re: Another userdata question, Marc Lepage
- RE: Another userdata question, Geoff Smith
- Re: Another userdata question, Andrew Starks
- RE: Another userdata question, Geoff Smith
- Re: Another userdata question, Andrew Starks
- Re: Another userdata question, Andrew Starks