|
Peter Loveday wrote:
How do you pass your userdata object into Lua calls? That is, say I have C++ code that wants to call a function like:int doSomething(MyObject* obj);Yep, in my case the number of calls like this is relatively minimal. I do indeed just push a newuserdatabox() every time. I haven't found this to be a problem for what I'm doing, but I can see that it could become prohibitive in other applications.
It turns out I only do this a few places in my code, but it gets run every frame (it's a game project) which adds up quickly. The number of such calls is likely to grow significantly once it gets out to the endusers, so it looks like I'll have to roll-my-own weak reference system. It's not that it's all that hard to do, just that it seems like something that should be built in. Jason