From: Paul K <pau...@ya...> - 2012-07-01 01:01:02
|
Hi John, > Download 2.8.12.1 and try it. I have tested with > luasocket-2.0.2-lua-5.1.2-Win32-vc8.zip downloaded from Lua binaries > and it works. This is huge progress; very close to where I'd like to be. I got the application working with these binaries (including luasocket) and almost all the functions I tested are working correctly. The UTF characters are also displayed and copied correctly. Couple of things that are not working. Shortcuts in the full screen mode I reported earlier are not working. Either something has changed or I did not test them correctly with the previous version. The other thing that is not working is the debugging for wxwidgets apps I have, which triggers this "wxLua: Creating a callback function in a coroutine is not allowed since it will only be called when the thread is either suspended or dead." message. This seems to be caused by the fact that I have two main loop in the application. Your earlier explanation sheds some light on this: > The logic to trigger this error is very > simple, when wxLua starts it saves a pointer to the lua_State* in the > Lua registry. When an event callback is created the given lua_State* > is compared with the original lua_State* in the registry and if they > don't match you must be in a coroutine which means that Lua will give > you an error about running code in a "suspended or dead coroutine" so > instead of that rather cryptic message given later I error out earlier. It seems like the check is too aggressive, as this functionality has been working fine before in many different situations (I have never had a single problem with it) and this is a deal breaker for me. As far as I can tell, any debugger that executes the main script in a separate co-routine (as mine does) will get this error. You can check it with this simple script: local func,err = loadfile('minimal.wx.lua') if err then error(err) end local ok, err = coroutine.resume(coroutine.create(func)) if err then error(err) end If you run this, you will get "minicoro.lua:4: minimal.wx.lua:49: wxLua: Creating a callback function in a coroutine is not allowed since it will only be called when the thread is either suspended or dead.", which should not really happen. > ps. Note that I don't think you ever got error messages from wx.dll... > When lua.exe is run it does a pcall() on the input file and so it gets > the error messages, I don't believe it's even possible for wxLua to > get them. I think what you got are print() statements? Though, it has > been a long time since 2.8.10 and I have not retested it. I have > reinstated the error handler, but it's never called, but it's there > and will pop up a dialog if it ever gets called. Run your program from > a DOS prompt and the print and error messages will be printed to the > console. This part seems to be working as I expect it to work (or even better). I do get a window with an error AND the same error reported to the console, which is good. I won't attach the screenshot, but you can see the same message I'm talking about if you take "minimal.wx.lua" sample and change wx.wxMessageBox to wx.wxMessageBox1 (anything that causes run-time error will do). I get a messageBox with "wxLua Runtime Error" title and this error message (also reported to stdout): wxLua Runtime Error: Lua: Error while running chunk minimal.wx.lua:79: attempt to call field 'wxMessageBox1' (a nil value) stack traceback: minimal.wx.lua:79: in function <minimal.wx.lua:78> [C]: in function 'MainLoop' minimal.wx.lua:96: in main chunk [C]: ? So, my main issue is that check for coroutine that breaks my debugging and some other functionality. Thank you! Paul. On Sat, Jun 30, 2012 at 1:48 PM, John Labenski <jla...@gm...> wrote: > Ok... lets start fresh and not try to debug the old stuff. > > Download 2.8.12.1 and try it. I have tested with > luasocket-2.0.2-lua-5.1.2-Win32-vc8.zip downloaded from Lua binaries > and it works. > > This is how I did it, put luasocket's bin/ mime/ socket/ dirs as > subdirs of the wxLua/bin dir (or anywhere, but then adjust > LUA_PATH...) then you can run : > > lua myapp.lua > wxLua myapp.lua > wxLuaFreeze myapp.lua > wxLuaEdit myapp.lua > > where myapp.lua has > > ------ > require("socket") > print("Is socket here ? ", socket) > > require("wx") > print(print, print_lua) > > f = wx.wxFrame(wx.NULL, -1, "Hello") > f:Show() > wx.wxGetApp():MainLoop() > ------ > > Success! > > Please read here to understand what lua51.dll and lua5.1.dll are all about: > > http://wxlua.svn.sourceforge.net/viewvc/wxlua/trunk/wxLua/modules/luaproxydll/proxydll.c?revision=100&view=markup > > DO NOT COPY someone else's lua51.dll into the wxLua bin dir, it will never work. > > ps. Note that I don't think you ever got error messages from wx.dll... > When lua.exe is run it does a pcall() on the input file and so it gets > the error messages, I don't believe it's even possible for wxLua to > get them. I think what you got are print() statements? Though, it has > been a long time since 2.8.10 and I have not retested it. I have > reinstated the error handler, but it's never called, but it's there > and will pop up a dialog if it ever gets called. Run your program from > a DOS prompt and the print and error messages will be printed to the > console. > > Regards, > John > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > wxlua-users mailing list > wxl...@li... > https://lists.sourceforge.net/lists/listinfo/wxlua-users |