ektrules wrote:
1) Why does "function start();" have no implementation in the class, and why is "function MyAI::start() {...}" outside the class? What does that do? Is "function start();" like an interface or something?
It's a standards/readability thing. The idea is that you have a function list at the top of the code and the functions proper lower down. Example: Which is easier to locate and read?
Code: Select all
class MyClass{
function AddThings(a, b);
function SubtractThings(a,b){
return a - b;
};
}
function MyClass::AddThings(a,b){
return a + b;
}
On such a small scale it's not very obvious but on much larger files it's real boon to just be able to look at the top for a function list.
ektrules wrote:2) Is "function MyAI::start()" static, public, or private?
Public. As far as I know squirrel doesn't do public or private.
ektrules wrote:
3) What's the difference between the "::" and "." operators?
:: declares the function, . calls it. To call the previous function you would use MyClass.AddThings(num1, num2);
ektrules wrote:
4) Does Squirrel support private class methods and private class variables?
See 2.
ektrules wrote:
5) Are there any editors that (at least) do syntax highlighting for Squirrel? I'm currently using Gedit with Javascript highlighting. That recognizes some things but not all.
Notepad++ set to C syntax works quite nicely.
ektrules wrote:
6) Not a syntax question but... Since AIList is hard-coded, would it be better to put items in it, and sort the whole thing to get the first few elements in the order you'd like, or use the heap queue class written in Squirrel?
Personally I use AIList as it's well documented in the same place as all the other NoAI functions. I don't know which is better, or even if there is a better/worse option.