Re: Casting to derived type (was: Member pointers in 0.8.1)
Daniel Wallin <[email protected]>
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <[email protected]> |
> I'd be interested in a solution for this as well. What we did as a > workaorund was to add cast functions to the lua bindings for the derived > classes, so you have to know that (in Lua) you receive a Object* and > then convert like this: local actor = Actor.cast(myobject). > It does feel wrong to introduce casts like this to a dynamic > language, > but at least it works. Ultimately, we rewrote part of our project > specifically because of these problems and reimplemented some of the > classes in pure lua. > I really wish luabind was more intelligent and forgiving when it > comes > to (smart)pointer casts and general usage. FWIW, the next release is much better in this regard. It will perform automatic down-casting then a reference to a polymorphic type is passed to Lua. Unfortunately I don't have much time to work on luabind right now, but hopefully I'll be ready to release the next version in a couple of months. -- Daniel Wallin BoostPro Computing http://www.boostpro.com ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects