[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Suggestion: add a new api lua_pushuserdata
- From: roberto@... (Roberto Ierusalimschy)
- Date: Wed, 13 Dec 2006 09:17:17 -0200
> Now, I create a weak table in registry. Then use luaL_ref to get a
> reference of the object, and save the reference number in my widget.
> When I need convert the pointer back to the lua object, I can use
> the reference number to lookup that weak table .
Instead of creating a reference you can use the widget pointer itself
as your key (as a light userdata).
> But I think it's a expensive way, Adding a new api lua_pushuserdata
> to convert the pointer back will much cheaper.
By "expensive" you mean too slow? If you are going to call back Lua,
it seems that two extra table accesses should make no relevant difference.
-- Roberto