lua-users home
lua-l archive

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


On 1/14/2013 5:33 PM, Jay Carlson wrote:
The fix for this would involve C-side deallocation turning Lua-side references into tombstones, and I don't see an obvious way to implement tombstones other than something that works out to be Tim's serial numbers.

I think it was Hadriel that mentioned serial numbers (though I admitted to using them); I was just suggesting going into Lua in the destructor (or an object-release function in C) and telling it that address is no longer valid. That turned out to be very difficult to do in tolua++, though I don't recall the specifics.

LuaBind seems to be the de facto standard binding for C++ these days, and it does actually support lifetime management of Lua objects. It just generates bindings that are HUGE and slow, which isn't ideal for games. I know of at least one iOS/Android game that uses LuaBind, though, so I know it's possible to use it (though the developer in question ended up tossing out LuaBind and creating their own binding generator to replace it).

Tim