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

Gammon Software Solutions forum

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

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Override Mushclient's luasocket

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Override Mushclient's luasocket

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Candido   USA  (78 posts)  [Biography] bio
Date Wed 21 Dec 2011 01:08 PM (UTC)  quote  ]
Message
Hello,

I am trying to get a mushclient world to load luasocket 2.0.2 instead of Mushclient's built in 2.0.1 because of a certain memory bug in 2.0.1.

I placed the socket.lua in my world's directory, along with the socket folder containing all the sub libraries and the core.dll. Before the requires in my script, I do a ChangeDir(GetInfo(67)) to make my world's directory the current directory.

It correctly loads socket.lua from the world directory, but then loads Mushclient's core.dll, even though it is supposedly lower priority than loading from current directory. When I delete Mushclient's core.dll, it correctly loads the one in my world's socket folder, but while Mushclient's files are in place there seems to be no way to get it to load mine first. It's already higher priority in package.path, so it doesn't look like I can get anywhere by manipulating that.

Here is my package.path

Quote:
;.\lua\?.lua;;.\?.lua;C:\Program Files (x86)\MUSHclient\lua\?.lua;C:\Program Files (x86)\MUSHclient\lua\?\init.lua;C:\Program Files (x86)\MUSHclient\?.lua;C:\Program Files (x86)\MUSHclient\?\init.lua;C:\Program Files (x86)\Lua\5.1\lua\?.luac


Here is my package.cpath

Quote:
.\?.dll;C:\Program Files (x86)\MUSHclient\?.dll;C:\Program Files (x86)\MUSHclient\loadall.dll


And here is a traceback for doing a require "socket.x" (the real command is require "socket.core")

Quote:
Immediate execution
module 'socket.x' not found:
no field package.preload['socket.x']
no file '.\lua\socket\x.lua'
no file '.\socket\x.lua'
no file 'C:\Program Files (x86)\MUSHclient\lua\socket\x.lua'
no file 'C:\Program Files (x86)\MUSHclient\lua\socket\x\init.lua'
no file 'C:\Program Files (x86)\MUSHclient\socket\x.lua'
no file 'C:\Program Files (x86)\MUSHclient\socket\x\init.lua'
no file 'C:\Program Files (x86)\Lua\5.1\lua\socket\x.luac'
no file '.\socket\x.dll'
no file 'C:\Program Files (x86)\MUSHclient\socket\x.dll'
no file 'C:\Program Files (x86)\MUSHclient\loadall.dll'
no file '.\socket.dll'
no file 'C:\Program Files (x86)\MUSHclient\socket.dll'
no file 'C:\Program Files (x86)\MUSHclient\loadall.dll'
stack traceback:
[C]: in function 'require'
[string "Command line"]:1: in main chunk


Everything seems to say it should load from the socket folder in the current directory first, but this is not the case. Is there anything I can do to work around this without changing Mushclient's files? Alternatively, officially upgrading Mushclient's luasocket to 2.0.2 would be great too. :)
[Go to top] top

Posted by Nick Gammon   Australia  (18,797 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 21 Dec 2011 08:43 PM (UTC)  quote  ]
Message
I'm not sure what you mean by Mushclient's core.dll.

There are (confusingly) two core.dll files supplied with LuaSocket. One goes into the mime subdirectory and one into the socket subdirectory. If you replace both of them with the correct ones from the download, and replace all the .lua files with the ones of the same name from the download, it should work. It did for me.

Anyway, version 4.81 will have LuaSocket 2.0.2 as you suggested.

- Nick Gammon

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

Posted by Candido   USA  (78 posts)  [Biography] bio
Date Reply #2 on Thu 22 Dec 2011 03:02 AM (UTC)  quote  ]
Message
Wow, I didn't even notice there was a second core. Still, it doesn't seem to help any. If you mean replace Mush's .lua files and dll's, then yes that does work. What I was trying to do though was make it load a copy of luasocket from the world's directory instead from mushclient's. That way I could deploy the world on other computers without any assumptions about their installation. This didn't work because somehow it was defying the package.path ordering, but if 4.81 will have it, then I'm not going to lose any sleep over it.
[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.


869 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]