lua-users home
lua-l archive

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


I have an interesting problem that I just can't seem to figure out.  I'm
using the inheritsFrom example source provided from the tutorial at:
http://lua-users.org/wiki/InheritanceTutorial.  Everything seems fine
until I use it against an object that is created outside of Lua that
has property readers and writers (getters and setters).

The properties just go away.  For example, my class surfaced to Lua
looks like:
TGUIElement = {__index={x = cfunc_GetX, y = cfunc_GetY}, __newindex={x =
cfunc_SetX, y = cfunc_SetY}}
(Although the actual implementation is different where index and
newindex point to cfunctions)

Now if I create a TGUIElement everything works fine.  Use the code:
TLabel = inheritsFrom(TGUIElement)
function TLabel:OnDraw()
end

Looking at TLabel everything appears to be fine.  Try to access L.x
though and I get an error saying that its nil.  So how would I go about
modifying the inheritsFrom source so that it propigates down the
existing properties?

 - Jeremy

"Help I suffer from the oxymoron Corporate Security."