I'd be grateful if someone could explain the Celestia "obs:getlocationflags()". I can't get it to work, probably because I don't understand it. I would think locations would attached to an object, and not an observer. But when I make the call on the observer object as documented, I don't seem to get a table.
Also, under object:getinfo() the documentation refers to a "location object" as if some objects are a different class of object.
Please give some help to the terminally confused.
Henry
It's All About Location
-
- Site Admin
- Posts: 4211
- Joined: 28.01.2002
- With us: 22 years 9 months
- Location: Seattle, Washington, USA
Re: It's All About Location
hharris wrote:I'd be grateful if someone could explain the Celestia "obs:getlocationflags()". I can't get it to work, probably because I don't understand it. I would think locations would attached to an object, and not an observer. But when I make the call on the observer object as documented, I don't seem to get a table.
Locations are attached to an object. The table of location flags returned by getlocationflags just identifies what types of locations will be visibile. For example, crater labels will not be shown unless craters is set to true in the locationflags table. There is currently no way to get the list of locations in celx, but that will be fixed very soon (as in, before the end of the week.)
Also, under object:getinfo() the documentation refers to a "location object" as if some objects are a different class of object.
Please give some help to the terminally confused.
There's no special Lua type for location objects--they look just like other objects. You can tell if an object is a location by checking the result of the object:type() method.
--Chris
-
- Site Admin
- Posts: 4211
- Joined: 28.01.2002
- With us: 22 years 9 months
- Location: Seattle, Washington, USA
The locations method is now available in the latest revision of Celestia on SVN (4123). It's a method of the object class that returns a Lua iterator. The usage is straightforward. This example code prints the names of all locations for the currently selected object:
--Chris
Code: Select all
function log_locations(x)
for loc in x:locations() do
celestia:log(loc:name())
end
end
log_locations(celestia:getselection())
--Chris
-
- Developer
- Posts: 3776
- Joined: 04.02.2005
- With us: 19 years 9 months
-
- Developer
- Posts: 3776
- Joined: 04.02.2005
- With us: 19 years 9 months