On Wed, Feb 15, 2012 at 3:14 AM, Milind Gupta <milind.gu...@gmail.com> wrote:
> Hello John,
>
>           thanks for the reply. Here is an example code that does not work

Please try to provide enough code to make it run out of the box... I
had to add back GUI.initFrameH and rem out the usage of MainSizer to
make it even possible to run without error.

> (Pasted below and attached the file as well). A function from the main wxlua
> application calls filterFormActivate which sets up a simple frame with 2
> buttons and one static text and associates the button click to SelTaskPress.

I made the help menu callback function of the minimal.wx.lua sample
call filterform.filterFormActivate(frame).

> But when the button is clicked the test() statement gives an error. If that
> is removed then it cannot recognize the frame varaiable in the
> wx.wxFrame(frame line after test().

Please always include these errors in the future to help diagnose the problem.

In order to solve your problem I made test() a local function so that
it will be an upvalue of the Connect() function that calls it. Note
that the 'frame' that is used in the SelTaskPress() function is the
frame from the minimal.wx.lua and not the frame from
filterFormActivate().

To be honest, I have not done too much with modules and require in Lua
since I'm not sure I fully understand its behavior.

I just came across this which clears some things up for me. Note the
sentence "This means that any global functions are not visible by
default, which is why we had to create a local alias to print." This
is probably also why making test() local above fixed it. See also
package.seeall which might be useful to you.
http://www.luafaq.org/#T1.37

Hope this helps,
    John

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to