lua-users home
lua-l archive

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


Here is the link to the discussion I had in 2012 for this:

http://comments.gmane.org/gmane.comp.lib.wxwidgets.wxlua.user/2885

Regards,
Milind


On Thu, Jun 25, 2015 at 4:00 PM, John Labenski <jlabenski@gmail.com> wrote:


On Jun 25, 2015 5:55 AM, "Ericson Carlos" <rexonf@gmail.com> wrote:
>
> Old thread, but I ran into this 'problem' recently. Wanted to embed the
> editor.wx.wlua into my app so I could write test code with a nice editor
> without restarting the app. It couldn't run as a module due to the
> event-handling/environment issue so at first I modified the code to avoid
> naming conflicts and run it in the same environment. But I really wanted to
> run it as a module so I modified wxLuaEventCallback.
>
> The changes are minimal. Save the environment alongside the function in
> ::Connect and load it in ::OnEvent, instead of always loading the global
> environment.
>
> I could post my changes to wxLua if anyone is interested.
>

Yes please, I thought the callbacks worked in a module already. Though maybe it was not implemented the way you describe to avoid saving the env for each callback. You might want to look at the wxlua mailing list in 2012 or so for Lua code that will work for you. I can't test now, but I think you just need to prefix the module name to the function name for the callback func param.

Regards,
    John