Here are some very general questions about scripting:
(I'm running Celstia 1.4.1 (0) on a Mac OS X)
(1) What does a question mark after a parameter in the documentation indicate?
(2) I've noticed celx is very general with function parameter passing. In one case (goto) the function name is the same for two functions. Exactly how does celx work in this regard? I assume celx looks at the number and type of paramenters that are passed and then decides how to handle the input. Is this correct? What is considered an error; that is, when does it give up? Knowing this type of information will help me design my own functions.
(3) The documentation gives a distance (microlightyears) for speed. I assume it's really microlightyears per some time unit. What is that time unit?
Though my comments don't show it, I'm actually very impressed with celx.
Thanks!
Henry
General Questions about Scripting
Re: General Questions about Scripting
I believe these indicate missing information in the documentation.hharris wrote:Here are some very general questions about scripting:
(I'm running Celstia 1.4.1 (0) on a Mac OS X)
(1) What does a question mark after a parameter in the documentation indicate?
There is only one function involved, not two functions with the same name. The function recognizes the different parameter types internally. You can write such a function by specifying three dots at the end of the formal parameter list in the function definition. The actual parameters are passed in a table accessed as an implicit parameter named 'arg'. This is explained in the Lua reference manual. (The celx functions are actually implemented using the Lua C API, but the effect is the same).hharris wrote:(2) I've noticed celx is very general with function parameter passing. In one case (goto) the function name is the same for two functions. Exactly how does celx work in this regard? I assume celx looks at the number and type of paramenters that are passed and then decides how to handle the input. Is this correct? What is considered an error; that is, when does it give up? Knowing this type of information will help me design my own functions.
hharris wrote:(3) The documentation gives a distance (microlightyears) for speed. I assume it's really microlightyears per some time unit. What is that time unit?
It's probably seconds, but that's just a guess. You could write a simple script to find out for sure.
- Hank