[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]  Preventing mushclient from using local lua installation
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Preventing mushclient from using local lua installation

You need to log onto the forum to reply or create new threads.

  [Refresh] Refresh page


Pages: 1 2  

Posted by Victorious   (85 posts)  [Biography] bio
Date Thu 09 Nov 2017 06:01 PM (UTC)
Message
Hi,

I've installed lua 5.1 onto my own system to get luarocks for easier installation of libraries However, mushclient exploded the next time it was restarted because it was using my system's lua interpretor.

Additionally, after removing the path to lua.exe from my system path, it was still using the LUA_PATH and LUA_CPATH variables meant for my local lua install. Is there a way to stop this from happening?
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Fri 10 Nov 2017 04:08 AM (UTC)
Message
Exploded? Can you give more details?

- Nick Gammon

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

Posted by Victorious   (85 posts)  [Biography] bio
Date Reply #2 on Fri 10 Nov 2017 04:22 AM (UTC)
Message
It was using my installed lua interpretor's LUA_PATH and LUA_CPATH environment variable, which I defined, so when code in mushclient tried loading modules it was not able to find it.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Fri 10 Nov 2017 06:10 AM (UTC)
Message
It would help if you posted error messages, and preferably a minimal example to demonstrate what you are saying. I believe Fiendish uses LuaJIT in the Aardwolf distribution without any problems.

In other words, it is possible to use an external version of Lua. Lua is distributed as a standalone DLL, so it should be possible to substitute another one. As Fiendish has done.

- Nick Gammon

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

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #4 on Fri 10 Nov 2017 07:04 AM (UTC)

Amended on Fri 10 Nov 2017 07:11 AM (UTC) by Fiendish

Message
I believe Victorious has installed some other distribution of Lua.exe somewhere else, and that MUSHclient is picking up this other installation's search paths (which I assume are set as environment variables?) instead of looking only inside the MUSHclient folder, and Victorious wants MUSHclient to only look inside its own folder. I have no thoughts on this, as I work exclusively within the MUSHclient folder.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Fri 10 Nov 2017 07:30 AM (UTC)
Message
You mean Lua.DLL?

- Nick Gammon

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

Posted by Victorious   (85 posts)  [Biography] bio
Date Reply #6 on Fri 10 Nov 2017 07:43 AM (UTC)
Message
Yeah, Fiendish described my situation perfectly. Mushclient is picking up on information meant for my own locally installed lua distribution (outside mushclient). Apologies for not being clear. Will post errors soon, if that helps - but its just the standard error messages you get when require fails to find a module, showing you all paths its tried.
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #7 on Fri 10 Nov 2017 07:52 AM (UTC)

Amended on Fri 10 Nov 2017 07:57 AM (UTC) by Fiendish

Message
Nick Gammon said:

You mean Lua.DLL?


I think I mean Lua.exe, though presumably with its own Lua.dll next to it. I think the only bit that matters here is that Victorious wants MUSHclient to never search for includes outside of its directory no matter what the operating system says. Which, I have to be honest, seems both extremely weird but also contextually pretty reasonable. This is where I go ¯\_(ツ)_/¯

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Victorious   (85 posts)  [Biography] bio
Date Reply #8 on Fri 10 Nov 2017 08:11 AM (UTC)
Message
What I just did was added a LUA_PATH environment variable for my local copy of lua. And this is what happened the next time I restarted mushclient.


Immediate execution
[string "Plugin: SpellcompProducer"]:152: module 'wait' not found:
        no field package.preload['wait']
        no file 'C:\Users\vic\AppData\Roaming\luarocks\share\lua\5.1\wait.lua'
        no file 'C:\Users\vic\AppData\Roaming\luarocks\share\lua\5.1\wait\init.lua'
        no file 'c:\lua\share\lua\5.1\wait.lua'
        no file 'c:\lua\share\lua\5.1\wait\init.lua'
        no file 'C:\Lua\LuaRocks\lua\wait.lua'
        no file 'C:\Lua\LuaRocks\lua\wait.lua'
        no file 'C:\Lua\LuaRocks\lua\wait\init.lua'
        no file '.\wait.dll'
        no file 'D:\documents\mushclient\wait.dll'
        no file 'D:\documents\mushclient\loadall.dll'
stack traceback:
        [C]: in function 'require'


So it is using my LUA_PATH environment variable instead of its own default one for package.path. Lua.exe is also not in my path.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #9 on Fri 10 Nov 2017 10:40 AM (UTC)
Message
Victorious said:

... instead of its own default one ...


What is the "it" in that sentence? I think we are talking at cross-purposes. Nothing has "exploded". You are using your own DLL which appears to be respecting your own environment variables. I'm not sure what it is doing that it shouldn't be.

- Nick Gammon

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

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #10 on Fri 10 Nov 2017 09:35 PM (UTC)

Amended on Fri 10 Nov 2017 09:51 PM (UTC) by Fiendish

Message
Nick Gammon said:

Victorious said:

... instead of its own default one ...


What is the "it" in that sentence? I think we are talking at cross-purposes. Nothing has "exploded". You are using your own DLL which appears to be respecting your own environment variables. I'm not sure what it is doing that it shouldn't be.


Victorious wants MUSHclient's Lua DLL to not know about the LUA_PATH system environment variable. The "own DLL" here is, as I understand it, somewhere else, and not associated with MUSHclient.


So there's...

C:\MUSHclient\Lua5.1.dll

And there's...

C:\SomeOtherPath\Lua5.3.dll

which is used by

C:\SomeOtherPath\Lua5.3.exe

And there's...

LUA_PATH=C:\SomeOtherPath\libs;C:\SomeOtherPath\lua

or whatever



And the complaint is that C:\MUSHclient\MUSHclient.exe with its linked C:\MUSHclient\Lua5.1.dll is digging around in C:\SomeOtherPath instead of staying confined to C:\MUSHclient

And the reason for the complaint is that C:\SomeOtherPath\lua has code for Lua 5.3 that doesn't work in Lua 5.1, or maybe uses a different library called "bit" which seems to cause a name collision with MUSHclient's included bit library, or some other problem of a similar nature.

Victorious, is that correct?

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #11 on Sat 11 Nov 2017 05:57 AM (UTC)
Message
I don't think MUSHclient changes the LUA_PATH variable in any way. Can you show where it does?

- Nick Gammon

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

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #12 on Sat 11 Nov 2017 03:25 PM (UTC)

Amended on Sat 11 Nov 2017 03:31 PM (UTC) by Fiendish

Message
I think, if I'm understanding this right, that Victorious basically wants these #defines to be made more MUSHclient-specific. Assuming also that they do what I think they do.
https://github.com/nickgammon/mushclient/blob/master/luaconf.h#L69

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #13 on Sat 11 Nov 2017 09:33 PM (UTC)
Message
You mean line 90?

But ... if the defines there are the same as your own compiled defines would be, why do they need to be changed? In any case, since the Lua code is not compiled into MUSHclient, it won't reference those defines anywhere.

Nowhere in MUSHclient is LUA_PATH referenced or changed. It is just something in luaconf.h which is used when compiling Lua. Now if you use your own Lua compile they won't be used at all.

It sounds like Victorious may need to set LUA_PATH early on in using Lua, for example in Global Preferences -> Lua -> Preliminary code.

- 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 #14 on Sat 11 Nov 2017 09:35 PM (UTC)
Message
Possibly it might also help to put the custom Lua DLL into the same place that MUSHclient has it (ie. the executable folder).

- 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.


1,604 views.

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

You need to log onto the forum to reply or create new threads.

  [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]