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 ➜ Possible new client written using wxWidgets?

Possible new client written using wxWidgets?

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


Pages: 1  2  3 4  5  6  7  8  9  10  11  

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #30 on Fri 24 Aug 2007 09:25 PM (UTC)
Message
Quote:

if the proposed new client means that we can no longer use our external scripts if they are written in anything but lua, then that's a big no for me..


I wasn't really imagining that existing scripts, in any language including Lua, would be useable, because a new client would have new interfaces. For example, unless it was a clone of the existing client (in which case, what would be the point?), then triggers/aliases/timers and so on would be a bit different.

Say we got rid of the notepad window and put in a pane attached to the main window - then all the SendToNotepad (etc.) function calls would not work. Say we got rid of the Info Bar and instead had an "info pane" which worked differently. Then all the calls to write to the Info bar would fail.

If you want backwards compatability, then the way to go is probably just enhance the existing client.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #31 on Fri 24 Aug 2007 09:38 PM (UTC)

Amended on Fri 24 Aug 2007 09:39 PM (UTC) by Shaun Biggs

Message
There is still a huge difference between changing the interfaces and having to switch languages while changing all the interfaces at the same time. At least with being able to keep the same language, the general flow of the plugin will stay the same in most cases. I don't think anyone is expecting to just drop their old plugins into the new client and have them run with no problems. However, having to start from scratch with a completely unfamiliar language on a very complex script is a different story.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Onoitsu2   USA  (248 posts)  Bio
Date Reply #32 on Sat 25 Aug 2007 01:40 AM (UTC)

Amended on Sat 25 Aug 2007 01:41 AM (UTC) by Onoitsu2

Message
Ok I keep hearing complaints about switching to another scripting language, and cannot understand the reluctance in doing it. I initially when using mushclient did not know Lua, but the moment I heard that it was cross-platform (as much as is possible) I stopped using VB, and learned Lua as fast as possible. I mean if you are familiar with ANY scripting language that mushclient uses, then you can easily LEARN another one, due to the massive similarities between them all.

Notice I did not say it would be easy to CONVERT them to another language, but the same scripting principals apply.

I LOVE Lua for the tables, as they are much easier than the standard (as standard as the term can be) arrays, and accessing of them. As well as the ability to import new scripts on the fly, unlike many languages that are a pain to use dynamic scripting features.

You all might want to consider learning it, not consider using it, but at very least learn a few syntax techniques that are used in Lua. I mean even the help file as it exists now makes learning the language very easy, as well as converting concepts and commands from one language to another.

Just my 2 cents,
Onoitsu2
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #33 on Sat 25 Aug 2007 08:51 AM (UTC)
Message
Onoitsu2, I can't help but reply.

Yes, languages have a lot of similar features. However, can you tell me where I can find proper set behaviour for Lua? Generators? Read/write to the registry? Preferably without inventing the wheel itself -- Pythons extensive library of functionality is why I chose it over Lua. Like Lua, it is free to use, works on all OSes (except for MUSHclients implementation using Active Scripting, ironically) and I pretty much think the syntax is far more desireable than Lua's.

I know how to make my basic plugins in Lua. I also know I spend time looping through tables, implementing stuff like v_in_table(value, table) and similar. But for anything other than elementary scripting, I am very glad I'm not stuck with Lua.

Anyhow, sorry for the slightly offtopic reply. I'm just saying that Lua is not a solution for everyone.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #34 on Sat 25 Aug 2007 02:46 PM (UTC)
Message
While I agree that it's not really useful to argue one language's functionality over another, except for very objective concerns like presence of standard libraries (where Lua is (somewhat deliberately, actually) lacking), I did think I should try to address your concerns.

Set behavior:
Make a table. An object is in the set if the table keyed to that object is non-nil. An object is not in the set if the table keyed to that object is nil. Pretty simple.

Generators:
Well, I've seen this word used to mean several things, so I'm not exactly sure what you mean. Lua has closures, and so you can return functions with 'state', e.g. a function that returns a number that grows by one every time you call it. In fact this is trivial to do.

Registry access:
Deliberately absent from standard libraries; whether or not that is a good thing depends on your needs. You would have to provide this functionality yourself (or from somebody who wrote a registry extension). But, if you had such a thing written (and I'm sure it has been already) it would be a one-liner to include it.

Like I said, I'm not sure there is much point getting into religious wars about scripting languages, but I get the impression that you are knocking Lua more because you don't know it than because you've fully evaluated both languages. Syntax is one thing (I think it's a subjective preference issue, really) but you make it sound like Lua is only good for the simplest of scripting needs.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Shadowfyr   USA  (1,790 posts)  Bio
Date Reply #35 on Sat 25 Aug 2007 05:44 PM (UTC)
Message
Yeah. Python is sort of an oddball in some ways. Basically, *it* includes IO functions, some GUI, etc., in its *main* system, since it presumes you are going to be coding applets with it, not just scripts, even if not everything you need to make truly complex ones exist in its standard libraries. Lua presumes you are, well..., just writing a script, not an entire applet. As a result, all the extra stuff Python has is relegated to "other" libraries. This also means, ironically, that half the stuff in something like the wx extensions for Python are *redundant*, in that they already exist in some fashion, if sometimes limited, in the main Python.

Its like complaining that you hate C++, because you can't just too the program, "a = new frames.window(blah)", or something, but you, or someone else, has to **gasp!!** actually tell the language what the heck the 'frames' class is, and what its 'window' function does. Yes, that is moderately annoying if you don't already have the library to do it. So what? It also means that you can, or someone else can, design one that does what "you" want, not what some person you never met thought it should do.

And just one point.. I am sure there are .ini style configuration libraries around, since that is more cross-platform than using the registry, so unless you are doing something dangerous (and imho potentially stupid, not to mention possibly restricted under things like XP or Vista), you shouldn't need to screw with the registry anyway. Why is it dangerous and possibly stupid? Because when you start making changes to code that handles that, its damn easy to forget a " or get something wrong, while thinking about something else, and accidentally scramble something else's data, your own data, or even nuke an entire branch of the tree full of keys (at least on older OS versions, where there *are* no restrictions on editing the registry and no "restore to previous state" function). Oh, and then there is the fact that under 95/98, the registry is buggier than a termite mound. lol
Top

Posted by Isthiriel   (113 posts)  Bio
Date Reply #36 on Sun 26 Aug 2007 05:40 AM (UTC)
Message
Quote:
Onoitsu2 wrote:
I stopped using VB, and learned Lua as fast as possible.

That's understandable :D Lua > VBScript for everything that doesn't involve COM. (Afaik VBScript doesn't even have a native associative array type? Relying on a COM object to get that functionality.)

Quote:
David Haley wrote:
Set behavior:
Make a table. An object is in the set if the table keyed to that object is non-nil. An object is not in the set if the table keyed to that object is nil. Pretty simple.

Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> c = set(['red', 'green', 'blue', 'blue'])
>>> c
set(['blue', 'green', 'red'])
>>> c.add('red')
>>> c.add('yellow')
>>> c
set(['blue', 'green', 'yellow', 'red'])
>>> c & set(['red', 'blue'])
set(['blue', 'red'])
>>> c | set(['red', 'black', 'white'])
set(['blue', 'green', 'yellow', 'black', 'white', 'red'])
>>> 'blue' in c
True
>>> 'mauve' in c
False
>>> len(c)
4
>>> c.issuperset(['red', 'yellow', 'blue'])
True
>>> c.issubset(['red', 'yellow', 'blue', 'green', 'purple', 'orange',])
True
>>> 


Quote:
David Haley wrote:
Generators:
Well, I've seen this word used to mean several things, so I'm not exactly sure what you mean. Lua has closures, and so you can return functions with 'state', e.g. a function that returns a number that grows by one every time you call it. In fact this is trivial to do.

(Example taken from the Python manual.)
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> def counter(ul = 0):
	i = 0
	while ul < 1 or i < ul:
		v = (yield i)
		if v is not None:
			i = v
		else:
			i += 1

>>> for i in counter(10):
	print i,

0 1 2 3 4 5 6 7 8 9
>>> c = counter(10)
>>> c.next()
0
>>> c.send(5)
5
>>> for i in c:
	print i,

6 7 8 9
>>> 

The PEP (Python Enhancement Proposal) that described generators also includes a how-to for turning them into coroutines.

Quote:
David Haley wrote:
Registry access:
Deliberately absent from standard libraries; whether or not that is a good thing depends on your needs. You would have to provide this functionality yourself (or from somebody who wrote a registry extension). But, if you had such a thing written (and I'm sure it has been already) it would be a one-liner to include it.

The _winreg library is part of Python's standard library, but then so is pwd and fcntl on *nix and Carbon on Mac OS X.

What I'd miss most of Python is the interactive mode that allows on-the-fly debugging

Quote:
David Haley wrote:Syntax is one thing (I think it's a subjective preference issue, really) but you make it sound like Lua is only good for the simplest of scripting needs.

Syntax: yes and no. Most people think of syntax as a preference, but there are syntaces(?) that are objectively better than others. I haven't seen a comparison between Lua and Python. (I have seen Python vs C, C++, C#, Java, Ada and VB. Python pwnz0red. :D )

I won't say that Lua is only good for the simplest of scripting needs.

I will say that the most complicated (function points) script I could maintain in Lua would be much less complex than the most complicated script I could maintain in Python.

Quote:
Shadowfyr wrote:
This also means, ironically, that half the stuff in something like the wx extensions for Python are *redundant*, in that they already exist in some fashion, if sometimes limited, in the main Python.

Tkinter requires knowing Tk. (And it is a full implementation of Tk not just "some GUI stuff".) Tkinter however produces Tk-looking components. wx produces native-looking components.

Quote:
Shadowfyr wrote:
Yes, that is moderately annoying if you don't already have the library to do it. So what? It also means that you can, or someone else can, design one that does what "you" want, not what some person you never met thought it should do.

If you use "crippling" instead of "moderately annoying", I'd agree with you :P

In terms of programmer (me) effort, the difference between: (1) importing the necessary library (which is well documented); (2) finding a library that does what I want it to do (AND has adequate documentation) somewhere on the web, downloading it, getting it to work in my environment and then importing (and possibly converting between data types) and (3) hacking something together from scratch is something like (1) five minutes, (2) an hour, (3) upwards of six hours depending on complexity.

Trying to reimplement Python's _winreg in Lua (where "in Lua" may mean "in C, but with Lua bindings") could take weeks to months :P

Quote:
Shadowfyr wrote:
I am sure there are .ini style configuration libraries around, since that is more cross-platform than using the registry, so unless you are doing something dangerous (and imho potentially stupid, not to mention possibly restricted under things like XP or Vista), you shouldn't need to screw with the registry anyway.

Python has ConfigParser in the standard library for reading and writing .ini files.

Though, I am wondering why you say "use an external library" (which may or may not have working cross-platform implementations) in the previous paragraph and then complaining about the portability of anything built on the registry in this paragraph.

Quote:
Shadowfyr wrote:
Oh, and then there is the fact that under 95/98, the registry is buggier than a termite mound.

The Official Microsoft-Enforced Jargon for HKCU/HKLM/HKCC/HKU/HKCR is "hive(s)". Draw what conclusions you may :D
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #37 on Sun 26 Aug 2007 06:24 AM (UTC)

Amended on Sun 26 Aug 2007 06:25 AM (UTC) by Nick Gammon

Message
It would be trivial enough to provide a library that supports accessing the Registry, in Lua, however I am not sure I would want it to be available to plugin writers. "Hey, install my plugin and let me get full access to your Registry!".

In fact, as far as I can see, PCs (including Macs and Linux) have a fundamental flaw in their security design. They seem concerned about whether the user is who he says he is, and what rights that user has. For example:


  • Who is the user? (name/password) - eg. is the user "Nick Gammon"?

  • What is the user allowed to do? (eg. is he an administrator, can he install programs, can he access certain directories, etc.)


However it seems to me the germane question is: can the program be trusted?

Let's take an example, say I download a program that purports to tell my horoscope, or predict when the moon will be full again. I would be annoyed to find that such a program:


  • Opened files in my personal folder
  • Connected to a web site somewhere in the world
  • Sent those files to it


Now, I am allowed to open my personal files, and connect to web sites, but I may not want some unknown program to do it.

I don't know of any security system that lets me specify things like:


  • Unless I say so, this program cannot read files, except in certain directories (eg. its configuration files)

  • Unless I say so, this program cannot connect to the Internet

  • Unless I say so (eg. by saving a file), this program cannot write files


Note, that I am saying "this program", not "this user". I trust the user (myself), but not necessarily programs I get from who-knows-where.

With my firewall, I sometimes find that a certain program (that I have not heard of) is trying to make a connection to some site on the Internet. This is the sort of thing I am talking about. There have been cases a while back (probably is still happening) where when you play some game you bought, it is connecting to the manufacturer's site, and uploading information about the fact that the game is being played, and by whom, and what sort of PC they have, and so on.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Isthiriel   (113 posts)  Bio
Date Reply #38 on Sun 26 Aug 2007 07:07 AM (UTC)

Amended on Sun 26 Aug 2007 07:08 AM (UTC) by Isthiriel

Message
Quote:
However it seems to me the germane question is: can the program be trusted?

Microsoft don't want you thinking about that. The Windows XP and Vista install processes both "phone home" to Microsoft with your system specs.

Quote:
I don't know of any security system that lets me specify things like:

Most firewalls (ie everything but the Windows XP firewall) will allow you to control which applications are allowed to access the network.

*nix has trusted applications (that are installed in /bin/ or /usr/bin or /usr/local/bin and have the full rights of the user) and untrusted applications (that some user has installed in their home directory and can never have more rights than the user). If you're a superuser it's fairly straightforward to set up an application to run under another username, with no access to anything but what it absolutely needs. (This is SOP for http servers.)

XP (and Vista) will let you fake this by running the program with another user ... of course this is not easy and it screws itself up fairly regularly. It is theoretically possible though.

Quote:
There have been cases a while back (probably is still happening) where when you play some game you bought, it is connecting to the manufacturer's site, and uploading information about the fact that the game is being played, and by whom, and what sort of PC they have, and so on.

Blizzard and Steam are both famous for it. Most copy protection schemes are doing it now though.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #39 on Sun 26 Aug 2007 09:41 AM (UTC)

Amended on Sun 26 Aug 2007 09:42 AM (UTC) by Shaun Biggs

Message
Quote:
Isthiriel:
Trying to reimplement Python's _winreg in Lua (where "in Lua" may mean "in C, but with Lua bindings") could take weeks to months :P

More like a few minutes: http://www.lua.org/pil/27.3.1.html The registry becomes a Lua table. You can then use SWIG to create a module for Lua with the functionality you want. Lua is missing this because of the reason Nick mentioned: hurray security risk!

Quote:
Nick Gammon:
In fact, as far as I can see, PCs (including Macs and Linux) have a fundamental flaw in their security design. They seem concerned about whether the user is who he says he is, and what rights that user has.
However it seems to me the germane question is: can the program be trusted?

Vista seems to actually be trying this out, with horrid design flaws though. Programs, peripherals, and data files all have security ratings, and can only do things based on that security setting. Granted, the first answer I hear to "I can't get this program to..." is "Just run it as administrator." Being able to do this, to me, defeats the entire purpose of this security.

Quote:
Worstje
Pythons extensive library of functionality is why I chose it over Lua. Like Lua, it is free to use, works on all OSes (except for MUSHclients implementation using Active Scripting, ironically) and I pretty much think the syntax is far more desireable than Lua's.

These are two of Python's greatest strengths... It seems like Pygeeks have made EVERYTHING into a library, including turning on and off the kitchen sink. It's the most extended scripting language I've seen. Python also forces pretty nice style into the scripts due to syntax, and it's quite easy to follow script flow.

I personally prefer Lua due to being able to create some weird, yet simple data structures. I assume that you like Python for the very same reason, so it's all a matter of preference. This is why you have someone who is a diehard Lua convert pushing for having more scripting language options in the client. Arguments over scripting languages are never really "winnable" since they quickly turn into personal opinion.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Isthiriel   (113 posts)  Bio
Date Reply #40 on Sun 26 Aug 2007 07:53 PM (UTC)
Message
Quote:
Shaun Biggs wrote:
More like a few minutes: http://www.lua.org/pil/27.3.1.html The registry becomes a Lua table. You can then use SWIG to create a module for Lua with the functionality you want. Lua is missing this because of the reason Nick mentioned: hurray security risk!

I don't think that's the Windows registry?

http://www.lua.org/pil/27.3.html
The registry mentioned here is a global table for storing static data from C functions. NOT the windows registry.

And access to the windows registry is less of a security risk than unrestricted write access to the disk. Under XP there are keys that cannot be changed without Administrator permission but user.dat can be trashed by any program.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #41 on Sun 26 Aug 2007 08:33 PM (UTC)
Message
Ah, got confused with registries. Either way, it is easy enough to make a module which uses a standard C library to access the registry. Lua meshes in with C extremely well.

Once again though, this is probably a moot point, since most information will have to be saved in a state file if MUSHclient becomes multi-platform.

It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #42 on Sun 26 Aug 2007 08:57 PM (UTC)
Message
Since I feel the Python vs Lua issue is derailing the thread, I'll keep this short and only mention why I needed scripting support. I got this little tool from someone that saves its settings in the registry. Depending on the world I have open, I want to adjust certain settings before starting it. I could rewrite the tool (don't have the source), but the tool does what I need, despite my silly workaround. (Btw, not everyone has a c++ compiler, knowledge of binding that and lua together in order to write a working regex interface. A link with said library is nice, but it is one more dependancy and source you may not be able to trust. All-in-one package for such things atleast gives me the 'I can trust this stuff' feeling, which loose libs will never have for me. But okay, I'm derailing again, sorry!)

In other words... I don't feel registry support (or other bigger features) should be a basic client feature, but the fact it is accessible through scripting makes scripting useful. You can't know the extremes some people go in scripting before someone has gone to said extremes.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #43 on Sun 26 Aug 2007 09:32 PM (UTC)
Message
I'm pulling these figures from a different thread, and they may be out of date, or even misleading (I'm not sure what is in each download exactly), but comparing sizes of script engines:


  • Lua download (lua5_0r2_Win32_bin.tar.gz) 72.5 Kb

  • Ruby installer (ActiveRuby18.msi) 4.5 Mb

  • Perl installer (ActivePerl-5.8.4.810-MSWin32-x86.msi) 12.4 Mb

  • Python installer (ActivePython-2.4.3.12-win32-x86.msi) 18.7 Mb


Lua is the only one that comes in at under a megabyte, in fact well under (like, 1/10 of a megabyte).

Looking at those figures, Lua is the only script engine you could reasonably include as "standard" with a client, because its size will have a minimal impact on the overall download size.

Maybe there are ways of including Python without needing to increase the size of the installer by 18.7 Mb, I don't know for sure.

However it seems to me that as soon as you say "in order to run this program you must go to www.some_script_site.com and then download a 15 Mb file (possibly giving your email address to start the download), and then install it", you are making it harder for people to use your program.




Anyway, I am sure Shadowfyr will be pleased to hear that I am looking at wxLua - this seems on the face of it to be a way of writing GUI applications with Lua as the base language.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #44 on Sun 26 Aug 2007 11:00 PM (UTC)

Amended on Sun 26 Aug 2007 11:05 PM (UTC) by Worstje

Message
Eh, maybe I am missing something trivial here, since I'm not all that awake right now. What prevents you from writing support for Python? If the interface is the same, you can just link against some headerfiles and be done with it, right?

Supply Lua as default scripting engine. MUSHclient (any client for that matter) needs a default sure-fire way to script in it. Merely leave the option there to use Python, Perl, Ruby and so forth if the user has those installed. E.g... like the current situation, except without Active Scripting.

Edit: Just looked something else up... Latest ZMud is around 6.7 MB, while the latest CMud is almost 10 MB. I realize size is important, but eh.. downloading a new mudding client is something you don't do daily, but usually only once. So what if it is a one-time 15MB download? Does wxLua support W95? If not, any pc after that should easily be able to deal with the storage space required. (Just an argument why size alone shouldn't be a deciding factor, but I fully agree with Lua being standard language.)
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.


370,940 views.

This is page 3, subject is 11 pages long:  [Previous page]  1  2  3 4  5  6  7  8  9  10  11  [Next page]

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.