[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  How to use iuplua in MUSH?
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

How to use iuplua in MUSH?

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Applehoo   China  (4 posts)  [Biography] bio
Date Sun 28 Nov 2010 11:58 AM (UTC)

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!
[Go to top] top

Posted by Ddid   China  (19 posts)  [Biography] bio
Date Reply #1 on Sun 28 Nov 2010 05:13 PM (UTC)
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")) ()


[Go to top] top

Posted by WillFa   USA  (525 posts)  [Biography] bio
Date Reply #2 on Sun 28 Nov 2010 06:43 PM (UTC)
Message
Since it's a dll...


print (package.cpath)

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.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Sun 28 Nov 2010 08:34 PM (UTC)
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
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Sun 28 Nov 2010 09:34 PM (UTC)
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
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #5 on Sun 28 Nov 2010 09:41 PM (UTC)

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
[Go to top] top

Posted by Ddid   China  (19 posts)  [Biography] bio
Date Reply #6 on Sun 28 Nov 2010 09:57 PM (UTC)
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.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #7 on Sun 28 Nov 2010 10:22 PM (UTC)
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
[Go to top] 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.


8,084 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]