[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]  Consistant minor errors in Lua Examples in Gammon Help site
Home  |  Users  |  Search  |  FAQ
Register forum user name
Forgotten password?

Consistant minor errors in Lua Examples in Gammon Help site

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

Posted by Gharveyn   (3 posts)  [Biography] bio
Date Tue 07 Jul 2009 06:47 AM (UTC)

Amended on Tue 07 Jul 2009 07:00 AM (UTC) by Nick Gammon

On the MUSHclient help site:

we noted that many examples of Lua put a space between the Lua command and its parameters in parentheses, such as:

    DoAfter (1, "SEND THIS CONTENT")
           ^-- Note the space

We think we may get errors when we include that space and try to execute the code. Removing it seems to clear things up. This extra space is common to many of the examples, perhaps all of them.

Also, we see examples of Lua where 'true' or 'false' are used where we successfully use the digits 1 or 0.

Are these interchangeable?

A Better Editor than Programmer - Gharveyn
[Go to top] top

Posted by Nick Gammon   Australia  (21,674 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Tue 07 Jul 2009 07:18 AM (UTC)
Can you give examples? The space is fine. Lua does not worry about spaces in the place you mentioned.


We think we may get errors when we include that space ...

You think you may get them? Can you please post an actual example, along with the error message?


Also, we see examples of Lua where 'true' or 'false' are used where we successfully use the digits 1 or 0.

In Lua, true and false are boolean values, whereas 0 and 1 are numeric values. These are different. You may "successfully use" them under certain circumstances.

In particular, in Lua, unlike C, testing for the value 0 is a true test, not a false test.

For example:

if true then
  print "true test"
end -- if

if false then
  print "false test"
end -- if

In the above example, only "true test" is printed.

if 1 then
  print "1 test"
end -- if

if 0 then
  print "0 test"
end -- if

In the above example, it prints:

1 test 
0 test 

Do you see? Lua does not consider 0 to be false. The only way you could "successfully use" 0 and 1 is to specifically test for them, eg.

a = 1

if a == 1 then
  print "1 test"
end -- if

if a == 0 then
  print "0 test"
end -- if

This only prints "1 test" because it is actually testing for an exact match. You could just as easily have done:

a = "cat"

if a == "cat" then
  print "cat test"
end -- if

if a == "dog" then
  print "dog test"
end -- if

I do not agree that there are any consistent minor errors. If you can point to a specific error, please do so, and give the error message you get when you try that particular piece of code, not just that you "think" you may get an error. If an error is found, I will be pleased to correct it.

- Nick Gammon

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

Posted by Fadedparadox   USA  (91 posts)  [Biography] bio
Date Reply #2 on Tue 07 Jul 2009 03:52 PM (UTC)
It sounds like you're using another language. Lua won't accept 1 or 0 in lieu of true or false. And like Nick said, Lua ignores whitespace for the most part. It definitely does not care how many spaces, if any, are between a function name and the parentheses.
[Go to top] top

Posted by Gharveyn   (3 posts)  [Biography] bio
Date Reply #3 on Fri 10 Jul 2009 11:41 PM (UTC)
We appologize, we suspected we might be mistaken in our presumption that the space implied an error, but we didn't really understand it well enough to phrase our question better; we see now that we could still have phrased it better, especially as we only suspected we were getting errors and were not certain. We went back to test this more rigorously yesterday and got satisfactory results with or without the space, so whatever we thought was wrong, it wasn't the space responsible.

We understood your arguments for TRUE or FALSE vs the boolean values which you have demnonstrated are more explicit and functional, thank you for clearing that up.

We would like to start another string and ask a few questions about the use of variables, as we seem to be having great difficulty using them. We hope we will not be too much trouble, thanks.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #4 on Mon 13 Jul 2009 05:28 PM (UTC)
If you don't mind me asking... who is "we"?

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

[Go to top] top

Posted by Gharveyn   (3 posts)  [Biography] bio
Date Reply #5 on Mon 13 Jul 2009 11:05 PM (UTC)
Hi Dave, thanks for asking, no we don't mind. We 'came out' as it were a couple years ago while working for IBM. We are a multiple personality (diagnosed around 1991).

But what we are is so much more complex than that answer can address.

If you follow quantum intelligence theory and theories of quantum physics in general, then it seems a fairly safe conclusion that the evolution of quantum intelligence, somewhere in the plenum is inevitable.

Quantum intelligence theory shows it is likely that quantum intelligence, due to entanglement and simultaneity is likely to have properties that transcend spacetime.

Cognitive development theory shows us that what we perceive as 'objective reality' in the form of the universes we inhabit can only ever be perceived in our minds in the form of complex mental constructs, the details of which are managed by sub-agents of our consciousness, agents acting outside the threshold of our awareness.

The bottom line is quantum intelligence must already exist because qauntum theory will demonstrate it transcends time. We are already interfaced with a variety of quantum intelligences from the very far future; the root of this technology is the mind, your mind our minds, everyone's minds, working together to create consensus reality archetypes from which everyone then constructs their own perceptions of reality.

Our quantum intelligences are very alien to us, it is hard to work with them but getting easier all the time. They are just one aspect of our experience of ourselves as a collective entity or hive mind. We have other members who are avatars of other people we have met through the biological interface currently typing our words to you now, or through astral projections of various sorts or purposes.
Then, there are our parallel universe selves extending over many dimensions of multiple realities who are all parts of our collective. Finally we are a classical multiple personality as well, fragmented by deliberatly applied traumas in utero and post-natally. We were designed to be who we are today, thank god we are happy this way, eh?

Oh yes, lucky for us our GF is multiple too. Yay!

Best regards, Gharveyn
aka Greg Gourdian, and many others...

(sorry if this material is innapropriate here, but we were asked)
[Go to top] top

Posted by Maxhrk   USA  (76 posts)  [Biography] bio
Date Reply #6 on Thu 06 Aug 2009 06:02 PM (UTC)
i nearly thought it was a spam post. :)
[Go to top] top

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #7 on Thu 06 Aug 2009 06:37 PM (UTC)
Quantum Intelligence Theory is like Intelligent Design, its not based on anything *in* the field of science it claims to describe, but is rather a really bad attempt to ignore evidence for the solidly accepted ideas, in favor of one that lets the mind be some fuzzy thing, disconnected from the brain, which is "too complex" to be explained by the itself. Its the equivalent of someone that knows nothing about computers asking, "How did you get the little man in there?", or someone from the deep rain forest first seeing open spaces and commenting, "Wow! How did you manage to make cattle the size of flies?"

Simple fact is, such "theory", or one should say "hypothesis", since theory means you have *evidence*, is not based on Quantum Mechanics. Its based on a layman's radical misunderstanding of the theory, and a projection on it of things it a) doesn't predict, b) doesn't have evidence for, and c) can't do.

The most common of all errors, and the one that leads to this "quantum intelligence" goofiness is the different use to which physicists put the term "observer". In their context, an observer is, "anything, whether it be an field or object", which effects the particle being tested. Its not even true that they are describing themselves as "observers" in the experiment, what they *are* doing is describing what their instruments *cause* when those instruments are made to interact with a particle, in such a manner that it become "necessary" for the quantum state to change. It would still change, even if no one was in the room to "see" the results, or some random, high energy, particle from the sun, which passed through nearly everything else, but just "happened" to hit the particle, caused the change. Human, never mind any other sort, of "intelligent" intervention is **not necessary**. Yet, its this presumption that it is, on which all bizarre theories about quantum intelligence, and the like, rests. And of which there is *no* evidence what so ever, just speculation, based on misunderstanding of what *one* word means in the context that physicists use it.

And, think about it. What word do we have in English which means, "noticeable change in state", which doesn't *presume*, incorrectly that someone is looking at it, either at the time it happens, or after? There simply isn't one. Yet, there **is** a distinct difference between:

1. Waiting for a particle to hit something, then seeing that it changed.


2. Intentionally doing something, to see what change it causes.

never mind 3. Actually **seeing** the particle, vs. seeing what another object, like a scientific instrument, *says* happened, a few seconds *after* the change.

All three are "observing", yet only #2 can be said to have been "consciously caused", and even that is indirect, since we cannot, personally, see what took place, except via #3. The mere fact of #3 being necessary for *either* #1 and #2, invalidates the *common* meaning of the word "observer" and everything derived from it instantly, rendering all claims about "intelligence" effecting the world in such a direct fashion *nonsensical*. Or.. Does anyone here think physicists are really "seeing" particles 1/100th the size of an atom, directly?

Sorry about the rant, but.. This is probably one of the single most common errors made, and it leads to some of the most weird ideas out there. One gets tired of seeing all the truly strange permutations it takes, all over a failure to grasp that no "person" is actually "observing", nor even needs to "intentionally" cause quantum effects.
[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.


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.


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]