I have managed to get celestia compiling with LUA, and have added some code to allow developers of the LUA interface to document it.
The code writes a (synopsis?) of all the classes and methods out to a text file when the lua interface is initialised. Youll be able to turn it off with a switch of course.
I have added preliminary documentation for most of the interface but detailed descriptions of the methods would be better done by people who understand them.
This is the file that it produces
Code: Select all
object
:__tostring()
:radius()
returns the objects radius
:type()
returns the type of this object as a string
:spectraltype()
:absmag()
:name()
returns the name of this object
:mark([color],[symbol],[size])
marks this object with optionally specified color, symbol and size of marker
:unmark()
:getposition([time])
returs the current position of this object or it's position at time
:getchildren()
returns the set of objects that orbit this object
observer
:__tostring()
:goto(target,time,startinterval,endinterval)
makes the observer travel to the target with optional parameters
:gotolocation(position,time)
makes this observer travel to position taking time
:setposition(position)
:lookat(position,vector or position,position,vector)
makes the observer look at position with vector up optionally from another position
:setorientation(rotation)
:rotate(rotation)
:center(target,[time])
Centers the observers view on target
:follow(target)
makes this observer follow target
:synchronous(target)
makes this observer orbit target geosyncronously
:chase(target)
makes this observer chase the target
:lock(target)
locks the target in the observers view
:track(target)
makes this observer track target
:travelling()
returns true if the observer is travelling
:getframe()
returns the observers frame of reference
:setframe(frame)
sets the observers frame of reference to frame
:gettime()
returns the time
:getposition()
returns the observers position
:getsurface()
returns the observers displayed surface
:setsurface(string)
sets the observers displayed surface
celestia
:__tostring()
:flash(string,[duration])
flashes text on the screen
:print(string,[duration],[x],[y],[xoffset],[yoffset])
prints text on the screen
:show(flags...)
sets celestia to display the items in flags
:hide(flags...)
sets celestia to hide the items in flags
:showlabel(flags...)
sets celestia to show labels for the items in flags
:hidelabel(flags...)
sets celestia to hide labels for the items in flags
:getobserver()
returns the active observer
:getselection()
returns the current selection
:find(name)
returns the object with name
:select(name)
selects the object with name
:mark(object)
marks object
:unmark(object)
unmarks object
:unmarkall()
:gettime()
return the current time
:settime(time)
sets the current time
:gettimescale()
returns celestia's timescale
:settimescale(timescale)
sets celestias timescale
:tojulianday(year,[month],[day],[minutes],[seconds])
returns a number representing the julian day
:getstarcount()
returns the number of stars in celestia
:getstar(name)
returns the star with name
:newframe(cordsys,[object],[object])
returns a frame of reference in coordsys using the objects if neccassary depending on the coordsys
:newvector(x,y,z)
returns a vector with coords x,y,z
:newrotation(vector,angle)
returns a rotation around the axis vector with angle
:getscripttime()
returns the script time
position
:__tostring()
:distanceto(position)
returns the distance to position
:vectorto(position)
returns a vector to the position, from this position
:addvector(vector)
adds the vector to this position
:__add()
+ operator
:getx()
get x coord
:gety()
get y coord
:getz()
get z coord
vec3
:__tostring()
:__add()
+ operator
:__sub()
- operator
:__mul()
* operator
:__pow(vector,vector)
cross product of vectors
:getx()
get x coord
:gety()
get ycoord
:getz()
get z coord
:normalize()
normalise the vector so that it's length is 1
rotation
:__tostring()
:__add()
+ operator
:__mul()
* operator
frame
:__tostring()
:to(time,position,[orientation])
converts from universal to frame coordinates
:from(time,position,[orientation])
converts from frame coordinates to universal coordinates
This should help any users who want to script in LUA.
Ill send the code to Harold to see if he can work with it
Alex