Getting a parent?
Posted: 21.11.2005, 21:21
Why doesn't this script work?
According to http://celestia.h-schmidt.net/celx-summ ... t.html#API , 'parent' is a valid value returned from getinfo(), but while I can get a result from info.radius or info.rotationPeriod or info.type I can't get anything from info.parent. Instead I get an error message saying "[string "D:\Celestia\scripts\parent.celx]:9: attempt to concatenate global 'parent' (a userdata value)."
I tried this while selecting Earth (expecting "Sol" to be returned as the parent) and the Moon (expecting "Earth" to be returned as the parent).
More to the point, why is there a getchildren command and not a getparent command?
According to http://celestia.h-schmidt.net/celx-summ ... t.html#API , 'parent' is a valid value returned from getinfo(), but while I can get a result from info.radius or info.rotationPeriod or info.type I can't get anything from info.parent. Instead I get an error message saying "[string "D:\Celestia\scripts\parent.celx]:9: attempt to concatenate global 'parent' (a userdata value)."
I tried this while selecting Earth (expecting "Sol" to be returned as the parent) and the Moon (expecting "Earth" to be returned as the parent).
Code: Select all
target = celestia:getselection() -- set target object
planpos = target:getposition() -- find target position
celestia:select(target)
info = target:getinfo() -- get info on target
name = target:name() -- get name of target
parent = info.parent
celestia:flash( name .."'s parent is "..parent)
More to the point, why is there a getchildren command and not a getparent command?