Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Override Mushclient's luasocket

Override Mushclient's luasocket

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


Posted by Candido   USA  (78 posts)  Bio
Date Wed 21 Dec 2011 01:08 PM (UTC)
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. :)
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 21 Dec 2011 08:43 PM (UTC)
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
Top

Posted by Candido   USA  (78 posts)  Bio
Date Reply #2 on Thu 22 Dec 2011 03:02 AM (UTC)
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.
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.


14,503 views.

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

Go to topic:           Search the forum


[Go to top] top

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