|
How to use iuplua in MUSH?
|
Reply to this subject
Start a new subject
 
Refresh page
| Posted by |
Applehoo
China (4 posts) bio
|
| Date |
Sun 28 Nov 2010 11:58 AM (UTC) [ quote
] Amended on Sun 28 Nov 2010 12:07 PM (UTC) by Applehoo
|
| Message |
in lua5.1
require("iuplua")
file: hbox.wlua running ok..
but using it in luascript of Mush 4.43or higher.
Error:
Run-time error
World: pkuxkx_path
Immediate execution
[string "Script file"]:7: module 'iuplua' not found:
no field package.preload['iuplua']
no file '.\iuplua.lua'
no file 'D:\MUSHCL~1\lua\iuplua.lua'
no file 'D:\MUSHCL~1\lua\iuplua\init.lua'
no file 'D:\MUSHCL~1\iuplua.lua'
no file 'D:\MUSHCL~1\iuplua\init.lua'
no file 'D:\Lua\5.1\lua\iuplua.luac'
no file '.\iuplua.dll'
no file 'D:\MUSHCL~1\iuplua.dll'
no file 'D:\MUSHCL~1\loadall.dll'
stack traceback:
[C]: in function 'require'
[string "Script file"]:7: in main chunk
------------1.How to Use Iuplua in mush??-------
------------2.OR,How to use wxlua in mush-------
Thanks for your help!
| top |
|
| Posted by |
Ddid
China (19 posts) bio
|
| Date |
Reply #1 on Sun 28 Nov 2010 05:13 PM (UTC) [ quote
] |
| Message |
After you download all iuplua's dlls from iuplua project website, don't use require() statement, just use following code to load it.
assert (package.loadlib ("iuplua51.dll", "luaopen_iuplua")) ()
| top |
|
| Posted by |
WillFa
USA (517 posts) bio
|
| Date |
Reply #2 on Sun 28 Nov 2010 06:43 PM (UTC) [ quote
] |
| Message |
Since it's a dll...
and make sure the iuplua51.dll is in that path before you require it.
MushClient will inherit the system's LUA_CPATH variable too, if you wish so set one through the control panel.
Loadlib has been deprecated after lua 4.0 in favor of require, and it's usage isnt recommended. | top |
|
| Posted by |
Nick Gammon
Australia (18,770 posts) bio
Forum Administrator |
| Date |
Reply #3 on Sun 28 Nov 2010 08:34 PM (UTC) [ quote
] |
| Message |
IupLua looks very interesting, however I'm not sure you will get it to work in MUSHclient (nor wxlua).
The reason is that as these are graphical front-ends they will have their own event loops, processing mouse events, keyboard events and screen-draw events.
However MUSHclient also has an event loop. Which event loop eventually "gets control" is likely to lock out the other one.
To do graphics inside MUSHclient, I recommend the miniwindows, see:
http://mushclient.com/mw
An alternative could be to make a separate application using IupLua (or wxLua) and then "talk" to it using COM or via TCP/IP (or UDP) to send it information you want drawn graphically. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
| Posted by |
Nick Gammon
Australia (18,770 posts) bio
Forum Administrator |
| Date |
Reply #4 on Sun 28 Nov 2010 09:34 PM (UTC) [ quote
] |
| Message |
In particular I found this sentence in their documentation:
IUP can also work together with other interface toolkits. The main problem is the IupMainLoop function. If you are going to use only Popup dialogs, then it is very simple. But to use non modal dialogs without the IupMainLoop you must call IupLoopStep from inside your own message loop. Also it is not possible to use Iup controls with dialogs from other toolkits and vice-versa.
Lua scripts in MUSHclient don't have access to the main MUSHclient message loop (effectively it is the driving force behind the entire GUI interface). Thus it would be hard to call IupLoopStep, and thus you would effectively by stuck inside IupMainLoop until such time as you closed all the IUP windows, probably not something you want. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
| Posted by |
Twisol
USA (2,229 posts) bio
|
| Date |
Reply #5 on Sun 28 Nov 2010 09:41 PM (UTC) [ quote
] Amended on Sun 28 Nov 2010 09:42 PM (UTC) by Twisol
|
| Message |
Nick Gammon said:
In particular I found this sentence in their documentation:
IUP can also work together with other interface toolkits. The main problem is the IupMainLoop function. If you are going to use only Popup dialogs, then it is very simple. But to use non modal dialogs without the IupMainLoop you must call IupLoopStep from inside your own message loop. Also it is not possible to use Iup controls with dialogs from other toolkits and vice-versa.
Lua scripts in MUSHclient don't have access to the main MUSHclient message loop (effectively it is the driving force behind the entire GUI interface). Thus it would be hard to call IupLoopStep, and thus you would effectively by stuck inside IupMainLoop until such time as you closed all the IUP windows, probably not something you want.
You could approximate a very slow loop by using the OnPluginTick callback, however.
function OnPluginTick()
IupLoopStep()
end
|
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | top |
|
| Posted by |
Ddid
China (19 posts) bio
|
| Date |
Reply #6 on Sun 28 Nov 2010 09:57 PM (UTC) [ quote
] |
| Message |
I have done a few testings on IUPLua, it provide a method to close the iup.MainLoop, after the iup's dialog was closed. (I don't think wxLua has similar method)
...
...
...
dlg:showxy(iup.RIGHT, iup.CENTER)
iup.MainLoop()
dlg:destroy()
iup.Close()
But, when the iup.MainLoop running, some of MUSHclient's function will not working, such as command history, arrow key recalls partial command ...
After iup.Close(), MUSHclient will back to normal.
| top |
|
| Posted by |
Twisol
USA (2,229 posts) bio
|
| Date |
Reply #7 on Sun 28 Nov 2010 10:22 PM (UTC) [ quote
] |
| Message |
And this is why:
Nick Gammon said: IupLua looks very interesting, however I'm not sure you will get it to work in MUSHclient (nor wxlua).
The reason is that as these are graphical front-ends they will have their own event loops, processing mouse events, keyboard events and screen-draw events.
However MUSHclient also has an event loop. Which event loop eventually "gets control" is likely to lock out the other one. |
'Soludra' on Achaea
Blog: http://jonathan.com/
GitHub: http://github.com/Twisol | top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
2,048 views.
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )