Porting lua modules to python

Posted by Mr.lundmark on Sat 23 Oct 2010 05:16 PM — 5 posts, 25,609 views.

#0
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.
Netherlands #1
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.)
#2
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?
Australia Forum Administrator #3
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.
Netherlands #4
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.