[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]  Python
. . -> [Subject]  Porting lua modules to python
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Porting lua modules to python

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


Posted by Mr.lundmark   (46 posts)  [Biography] bio
Date Sat 23 Oct 2010 05:16 PM (UTC)
Message
Hey,

I've thought about starting to port some of the lua-modules to python modules. Such as movewindow.lua, colors.lua, mw.lua, etc. Is there any problems with me doing this?

I'll gladely give out all the things that I complete.

Cheers,
Simon.
[Go to top] top

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #1 on Sat 23 Oct 2010 05:52 PM (UTC)
Message
Shouldn't be a problem.

Not everything Lua can be ported though, since Nick only made some select things accessible to Lua. (Most, if not all, of the utils module comes to mind there.)

When you are done, or if you run into any problems, please do share. If you want to take it a step further and maintain them across releases as Nick adds / changes the originals, I am sure he'd appreciate that a lot too (but one step at a time should be great.)
[Go to top] top

Posted by Mr.lundmark   (46 posts)  [Biography] bio
Date Reply #2 on Sat 23 Oct 2010 07:33 PM (UTC)
Message
Hey!

Sounds great.

I've ported the movewindow for starters. I do have the issue though that the world-object is not accessable from the module that I create. Is there any way to get by this or do I need to start passing the world-object by function-scopes? I don't really understand why the module can't access it though, shouldn't in be in the global scope, or is it just in the global scope of the plugin?
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Sat 23 Oct 2010 07:58 PM (UTC)
Message
Do you mean a plugin? Plugins by design are in a different script space to the main world. If not, I don't know enough about Python to help.

- Nick Gammon

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

Posted by Worstje   Netherlands  (899 posts)  [Biography] bio
Date Reply #4 on Sat 23 Oct 2010 09:06 PM (UTC)
Message
Python modules (which you import) are by definition shielded a bit from the global scope. I think the best way might be, that when instantiating your class, you give the world object as a parameter, which then stores it in a temporary member.

Do note however that in the past I have had trouble storing the world reference. However, I was using an external program, which helped itself / MUSHclient over the crapper the moment the world closed. So I do not believe it should cause any trouble seeing how plugins don't last longer than the world they are a part of.
[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.


6,067 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]