From: John L. <jla...@gm...> - 2012-07-30 04:06:48
|
On Sat, Jul 7, 2012 at 8:44 PM, Anders Andersson <all...@gm...> wrote: Perhaps a little late... > I wonder why there is no wxLua development branch for wxWidgets 2.9.x, > currently there are a lot checkver in the interface files. Wouldn't it be > easier to create a wxLua dev branch and try porting some of the new code > then to just port everything when 3.0 is out. By the way, I don't think > wxWidgets 3.0 will be out any time soon, my guess is 1-2 years. Check > https://groups.google.com/forum/?fromgroups#!topic/wx-dev/38oca9be_7g I think that having separate interface files would make it very difficult to see what is in 2.8 and 2.9 so transitioning to 2.9 would be harder. > In the wxLua Manual it's mentioned that one can extend classes in Lua which > works well for small class, but not if you are adding a lot of new > functions. The problem is that in every function you add, the self variable You can do it this way : a = wx.wxPoint() function a:DoStuff(s) print(self:GetX(), self:GetY(), s) end a:DoStuff("hello") > must be added in the argument and you must assign that function to the > object. Is there a way to avoid this? The lua inheritance tutorial does not > seem to work here. I would create a function to create, setup, and return a wxLua class object and then you'd call that whenever you needed one of them. You can even call the function wxMyPoint() and it'd look and act just like a constructor. In fact, the constructors in the wx table are table's themselves with some metatable code to allow it to be called as a function. Regards, John |