[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]  Create an internet connection from Lua?
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Create an internet connection from Lua?

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


Pages: 1 2  

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Mon 08 Jun 2009 01:54 AM (UTC)

Amended on Mon 08 Jun 2009 01:55 AM (UTC) by Twisol

Message
I'm working on a number of plugins for MUSHclient, a few of which I need to be able to make a connection for. For example, I have some maps of Achaea on my website (in textual form), and I want to query my website and retrieve a given map. Is it possible to do this easily, or will I need to get a Lua extension DLL for this sort of networking functionality?

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Fadedparadox   USA  (91 posts)  [Biography] bio
Date Reply #1 on Mon 08 Jun 2009 02:49 AM (UTC)
Message
I was actually looking into that earlier, and I found these:

http://www.lua.org/pil/9.4.html
http://luaforge.net/projects/luasocket/
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Mon 08 Jun 2009 02:58 AM (UTC)
Message
There is a discussion here: http://www.gammon.com.au/forum/bbshowpost.php?id=4935

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #3 on Mon 08 Jun 2009 09:45 PM (UTC)

Amended on Mon 08 Jun 2009 09:51 PM (UTC) by Twisol

Message
It looks like the LuaSocket version you reference in that thread, Nick, is based on Lua 5.0; the directory structure and files in the version I downloaded appear to be different as well (for example, I can't find 'lua.lua' anywhere in the most recent version). I'll have to mess around with it to see how exactly to get it working.

Thanks, both of you. Hopefully I'll be able to get this to work with the plugin ideas I had. :)

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Tue 09 Jun 2009 12:10 AM (UTC)
Message
See this thread: http://www.gammon.com.au/forum/?id=7322

In particular, the part about "how to get luasocket to work" as it was written for Lua 5.1.

- 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 #5 on Tue 09 Jun 2009 12:12 AM (UTC)
Message
Or: http://www.gammon.com.au/forum/?id=8319

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #6 on Tue 09 Jun 2009 03:28 AM (UTC)
Message
I followed the directions, and tried the test code via the intermediate window (ctrl+I), but I get errors. I was sure to enable the DLL loading in the Global Preferences and reload my script file before trying, and I unzipped the luasocket files into the root MUSHclient folder just as your directions specified. Here are the errors:


Run-time error
World: VadiSol
Immediate execution
H:\Program Files\MUSHclient\lua\socket.lua:13: module 'socket.core' not found:
        no field package.preload['socket.core']
        no file '.\socket\core.lua'
        no file 'H:\Program Files\MUSHclient\lua\socket\core.lua'
        no file 'H:\Program Files\MUSHclient\lua\socket\core\init.lua'
        no file 'H:\Program Files\MUSHclient\socket\core.lua'
        no file 'H:\Program Files\MUSHclient\socket\core\init.lua'
stack traceback:
        [C]: in function 'require'
        H:\Program Files\MUSHclient\lua\socket.lua:13: in main chunk
        [C]: in function 'require'
        H:\Program Files\MUSHclient\socket\http.lua:11: in main chunk
        [C]: in function 'require'
        [string "Immediate"]:1: in main chunk



If you give 'H:' a weird look, I run MUSH off of my thumb drive, and that's the letter it gets normally on this particular computer.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by WillFa   USA  (525 posts)  [Biography] bio
Date Reply #7 on Tue 09 Jun 2009 03:35 AM (UTC)
Message
The files should be in the Lua folder under mushclient.exe's directory.

i.e. H:\Program Files\Mushclient\Lua\Socket\core.dll

[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #8 on Tue 09 Jun 2009 03:44 AM (UTC)
Message
That's not what Nick said in the post...

Quote:

Unzip that into the same directory as MUSHclient.exe (eg. c:\Program Files\MUSHclient if that is where you put it).

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by WillFa   USA  (525 posts)  [Biography] bio
Date Reply #9 on Tue 09 Jun 2009 04:04 AM (UTC)
Message
And you did that, and it didn't work.

Do this, and it will. ;)
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #10 on Tue 09 Jun 2009 04:12 AM (UTC)
Message
It still didn't work. =/

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by WillFa   USA  (525 posts)  [Biography] bio
Date Reply #11 on Tue 09 Jun 2009 04:18 AM (UTC)
Message

C:\Program Files\MUSHclient\lua\mime\core.dll
C:\Program Files\MUSHclient\lua\socket\core.dll
C:\Program Files\MUSHclient\lua\socket\ftp.lua
C:\Program Files\MUSHclient\lua\socket\http.lua
C:\Program Files\MUSHclient\lua\socket\ltn12.lua
C:\Program Files\MUSHclient\lua\socket\mime.lua
C:\Program Files\MUSHclient\lua\socket\smtp.lua
C:\Program Files\MUSHclient\lua\socket\socket.lua
C:\Program Files\MUSHclient\lua\socket\tp.lua
C:\Program Files\MUSHclient\lua\socket\url.lua



/http = require "socket.http"
/print(http.request("http://www.mushclient.com"))


works fine for me. I'm using LuaSocket 2.0.2 downloaded from LuaForge.
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #12 on Tue 09 Jun 2009 04:26 AM (UTC)
Message
I'm using the zip Nick supplied in that thread, it's not working no matter what way I do it. I'll have to try it with the one from LuaForge.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #13 on Tue 09 Jun 2009 05:03 AM (UTC)
Message
No luck with the one from LuaForge, even using the exact directory layout you have there. What in the world?

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #14 on Tue 09 Jun 2009 06:10 AM (UTC)

Amended on Tue 09 Jun 2009 06:11 AM (UTC) by Nick Gammon

Message
When I said "Unzip that into the same directory as MUSHclient.exe" I meant, preserving the directory structure in the .zip file. That is, in the folder under where MUSHclient is installed you should have three subfolders (in addition to the usual ones), namely:


  • lua
  • mime
  • socket


In those subfolders should be additional files. My structure isn't quite what Willfa has, I'll do a screenshot (see next page). However unzipping and preserving the directory structure should do it, as I said in the post.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[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.


17,230 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

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]