Re: How to approach this?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: How to approach this?
- From: Dirk Schippers <lua@...>
- Date: 2014年9月16日 14:42:02 +0200
Great, let's share :-)
I think I managed to do it, but some other bug is making it hard for
me at the moment. With all the testing&trial&error code I
have such bad code at the moment that I need to rewrite now and
hopefully find the bug that is causing things to go wrong at the
moment.
But I had it working for a moment, so I think it's ok! It's all very
logical and I have very carefully investigated the Lua stack at
every step to see if all was correct and all came back when I needed
it.
The only thing that was still a little bit difficult was how to get
from the window handle back to the light-user-data-with-metatable.
The only way I could find was the one hinted by Andrew earlier in
our discussion: by creating a table in the Lua registry with the
window handle as key and the light-user-data-with-metatable as
value.
I don't like the Lua registry (especially because of the keys that
should be carefully chosen to not mess things up - I use a
lightuserdata adressed to some static C variable as key - ), but I
think I needed it for this.
Or do you know if there is another/better way?