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 ➜ Python ➜ Porting lua modules to python

Porting lua modules to python

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


Posted by Mr.lundmark   (51 posts)  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.
Top

Posted by Worstje   Netherlands  (899 posts)  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.)
Top

Posted by Mr.lundmark   (51 posts)  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?
Top

Posted by Nick Gammon   Australia  (23,133 posts)  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
Top

Posted by Worstje   Netherlands  (899 posts)  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.
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.


20,359 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.