Re: Newbie needs a point in the right direction
First off, Lua, not LUA. I'll save you the hate mail from all the other members who worship the Accuracy God. They'll rip you to shreds for doing this.
Now on to your questions:
"self. "
Lua is Object Oriented (referred to as OO, when talking about a language as a whole, it is a language in which OOP [object oriented programming] is possible). "self.foo" is either a variable or a function of an object, the basic part of any object oriented programming language; "self" is the name of the object and "foo" is one of the object's attributes (basically a variable) or a function of the object. One of the main tenets of OO is a characteristic called "inheritance," which allows many "instances" ("living, breathing objects") of a class to gain attributes common to that class. Putting it into every day language, we'll compare these idea to dogs. Dog would be a class, while Lassie would be an object. Dogs, according to our classification, tend to satisfy a couple basic requirements: they are quadrupeds, they have fur, they have a long muzzle, they have long teeth, they usually have a tail and usually have paws. Dogs "inherit" these characteristics as a result of their being classified as "dogs." Now, specific types of dogs obviously have specific attributes. Lassie may have a Breed = Border Collie, while Rover may have a Breed = Bulldog. But they still both have fur, a long muzzle, long teeth, a tail, paws and walk on four legs. This is the advantage of OOP: you don't have to keep calling a "dog" a "dog" over and over again. You can define a class ("actor") which has large amount of shared attributes (note: these are fictional: "HasHealthPoints, HasHands, HasFeet") and then proceed to define specific types of objects ("CoalitionClone, Zombie, Brainbot") from that class.
In this case, the "self" object refers to whatever the object is, be it an actor, a scene, or otherwise (looks like its an actor in this case). Thus, the "self" object allows you to modify the attributes of the actor without typing "MoveableMan(Moveable Manager, a class which defines things like actors).Actor(another class).SomeActorObjectHere.attribute/method" every time. It's basically shortening the coding process for you.
I could go on and on about OOP, even with my superficial understanding of it. This is also entirely based on OO in general and not Lua or Cortex Command specifically, so if you see any factual errors, feel free to correct me. OO is extremely hard to wrap around the mind, and if you're interested in learning about it, I recommend an excellent PHP tutorial on it, even if you don't program in PHP. It gives you a good understanding of what OO is and how you might use it:
http://www.killerphp.com/tutorials/object-oriented-php/ Wikipedia also has a good, if bombastic and convoluted, page on Object Oriented Programming. It's a bit easier to understand if you have watched the video already
Unfortunately I can't help you much without educated guessing on your second question, but I can figure out a good idea of what it may mean. As you said, there is very little documentation on Cortex Command and its libraries of code (something that seriously needs to be remedied), and I have not coded anything in Lua or Cortex Command. You may want to take this part to Lord Tim, who is a Lua god. It would also help me at least to have a snippet of the rest of the code.
Quote:
MovableMan:isactor will return a zero if the object/actor/whatever, whose number is in the variable "self.cpubrain" doesn't exist?
Taking what we just learned about, self.cpubrain is looking at the actor which the rest of the script is referring to and checking the "cpubrain" variable. This may be set somewhere else in the script, or may be an inherited result of whatever actor is being created (ie: brain-class actors might have this attribute set to 1, while non-brains may have it set to 0). I'm not sure what the purpose of this line may be without having the rest of the code block that this if statement starts. It may be checking to see if the actor the user is currently controlling is a brain (or is considered one by the coder). Notice also the "not" in front of it, which will check to see if the "player is not controlling a brain." Often the best way to figure out code is to put it into human semantics and see if what follows makes sense in the context of the code.
Quote:
and activityman:activityRunning() will return a 1 if there is an activity running?
Sounds about right.
Don't take my word on this last question. Lord Tim would probably have a better answer for you. But I hope I at least covered the basics of OOP for you.