On Nov 30, 2007 2:45 AM, Hakkı Doğusan <[EMAIL PROTECTED]> wrote: > Hi, > > (It seems I can post with this mail address) > > In unittest you'll see following lines (at ~229): > > a = wx.wxRect(1,2,3,4); > function a.Print(self) return string.format("%d,%d,%d,%d", self:GetX(), > self:GetY(), self:GetWidth(), self:GetHeight()) end > PrintOk(a:Print() == "1,2,3,4", "Add a new lua function to an already > created wx.wxRect") > > I found that usage "trick" from the hard way :) I should have study > samples carefully..
I don't understand your program. Is there something wrong with the code or are you showing how to make "executable" modules? The executable module method is nice. Regards, John > > > -- > Regards, > Hakki Dogusan > > > -- 8< --[[ veryminimalframe.lua ]]----------------------------------- > local wx = wx > local setmetatable = setmetatable > local require = require > local module = module > local tostring = tostring > module"veryminimalframe" > > local function SaySomethingElse(t, s) > wx.wxMessageBox(tostring(t) .. "\n" .. > "Hello again, " .. (s or ""), > "wxLua", wx.wxOK, t) > end > > local function create(parent, id, title, pos, size, style) > local parent = parent or wx.NULL > local id = id or wx.wxID_ANY > local title = title or "wxLua Very Minimal Demo" > local pos = pos or wx.wxDefaultPosition > local size = size or wx.wxSize(450, 450) > local style = style or wx.wxDEFAULT_FRAME_STYLE > local frame = wx.wxFrame( parent, id, title, pos, size, style) > -- attach some methods > frame.SaySomething = function(t, s) > wx.wxMessageBox(tostring(t) .. "\n" .. > "Hello, " .. (s or "") .. "\n" .. > t.m_var, "wxLua", wx.wxOK, t) > end > frame.SaySomethingElse = SaySomethingElse > frame.m_var = "" > return frame > end > > -- simulate ctor > function __call(self, ...) > return create(...) > end > setmetatable(_M, _M) > > -- 8< --[[ application.lua ]]---------------------------------------- > local wx = wx > local module = module > local setmetatable = setmetatable > local require = require > local module = module > module"application" > > local function Run(t, ...) > local VeryMinimalFrame = require"veryminimalframe" > local fa = VeryMinimalFrame() > local fb = VeryMinimalFrame(wx.NULL, -1, "Testing module") > fa:Show(true) > fb:Show(true) > fa.m_var = "fa's member variable " > fa:SaySomething("fa") > fb:SaySomething("fb") > fb:SaySomethingElse("fb") > fa:Destroy() > --commented to left something to see fb:Destroy() > end > > local function create(...) > local a = {} > a.OnInit = Run > return a > end > > -- simulate ctor > function __call(self, ...) > return create(...) > end > setmetatable(_M, _M) > > -- 8< --[[ main.lua ]]----------------------------------------------- > local require = require > local App = require"application" > local a = App() > a:OnInit() > -- 8< -------------------------------------------------------------- > > > > > > ------------------------------------------------------------------------- > SF.Net email is sponsored by: The Future of Linux Business White Paper > from Novell. From the desktop to the data center, Linux is going > mainstream. Let it simplify your IT future. > http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 > _______________________________________________ > wxlua-users mailing list > wxlua-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wxlua-users > ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4 _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users