Page 1 of 1

It's All About Location

Posted: 12.02.2008, 12:41
by hharris
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

Re: It's All About Location

Posted: 13.02.2008, 21:39
by chris
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

Posted: 13.02.2008, 23:49
by chris
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:

Code: Select all

function log_locations(x)
    for loc in x:locations() do
        celestia:log(loc:name())
    end
end

log_locations(celestia:getselection())


--Chris

Posted: 14.02.2008, 11:16
by hharris
Great! Can you tell me where that's available for Mac OX? I couldn't find it with an Internet search.

Posted: 14.02.2008, 11:29
by ElChristou
hharris wrote:Great! Can you tell me where that's available for Mac OX? I couldn't find it with an Internet search.


I can post a fresh build if you really need it.

Posted: 14.02.2008, 11:41
by hharris
Well, I can appreciate this is probably not a burning issue with most users, but I believe this version may help me complete a large project I've been working on for several years .

Henry

Posted: 14.02.2008, 12:24
by ElChristou

Posted: 15.02.2008, 19:36
by hharris
Uh-oh. This version crashes almost immediately without doing anything except using the arrow keys. :cry:

Henry