I am quite new to Celestia +Lua programming but I know Object language programming.
I first need lot of testing on methods availables in Celx
Is there a default method available offering a sort of 'asString' functionality:
I mean a method returning a string containing the values of the members of any instance of common objets of Celestia, which could then be printed on screen:
for exemple:
earth.getposition() asString
number asString
vector asString
observer.getposition() asString
frame asString ???
Thanks
predefined print/asString methods for celx objects ?
-
Topic authorRjp buisson
- Posts: 31
- Joined: 18.03.2002
- With us: 22 years 8 months
- Location: Paris France
Re: predefined print/asString methods for celx objects ?
Rjp buisson wrote:Is there a default method available offering a sort of 'asString' functionality:
No, this is not available. There is a "tostring( )" function, which will return a string for the various objects, but the string will only give the type of object (like "[observer]" etc.).
Harald
Re: predefined print/asString methods for celx objects ?
Hi Rjp,
Welcome to Celestia scripting!
"number asString" could use the Lua function "tostring(number)". The "string.format (formatstring, number1, number2, ...)" function provides more control over formatting a number for display.
The type(var) function returns the type of variable (userdata, string, number, etc.).
To obtain the XYZ values for a vector or position object, you can use the Celx getx(), gety(), and getz() methods for each.
Hope this helps.
Welcome to Celestia scripting!
Rjp buisson wrote:earth.getposition() asString
number asString
vector asString
observer.getposition() asString
frame asString ???
"number asString" could use the Lua function "tostring(number)". The "string.format (formatstring, number1, number2, ...)" function provides more control over formatting a number for display.
The type(var) function returns the type of variable (userdata, string, number, etc.).
To obtain the XYZ values for a vector or position object, you can use the Celx getx(), gety(), and getz() methods for each.
Hope this helps.
-Don G.
My Celestia Scripting Resources page
Avatar: Total Lunar Eclipse from our back yard, Oct 2004. Panasonic FZ1 digital camera (no telescope), 36X digital zoom, 8 second exposure at f6.5.
My Celestia Scripting Resources page
Avatar: Total Lunar Eclipse from our back yard, Oct 2004. Panasonic FZ1 digital camera (no telescope), 36X digital zoom, 8 second exposure at f6.5.