Celestia/Celx Scripting/CELX Lua Methods/CEL command deleteview

From Wikibooks, open books for an open world
Jump to navigation Jump to search

deleteview[edit]

deleteview { view <viewnumber> }

Delete the view of the specified <viewnumber>.


Notes:

  1. Using this command only makes sense if there is at least one Muliti view left. This command has no effect on a Single view.

Arguments:

view <viewnumber>
A number, identifying the view on the screen to be deleted. Default is 1.
Must be a valid identifier, regarding the number of views on the screen, otherwise no delete will be performed.


CELX equivalent:

Based on the observer:deleteview() method.

  • Get observer instance of the active view instance within a Multi view and delete is.
obs = celestia:getobserver()
obs:deleteview()

-- OR --

  • Get observer instances of all views and delete the view with identifier <viewnumber>.
observers = celestia:getobservers()
observers[<viewnumber>]:deleteview()


Example:
Split the screen in 4 equal parts and delete view number 3 after 5 seconds.

CEL:

splitview { view 1 type "V" position 0.5 }
splitview { view 1 type "H" position 0.5 }
splitview { view 2 type "H" position 0.5 }
wait { duration 5.0 }
deleteview { view 3 }

CELX:

obs = celestia:getobserver()
obs:splitview("V", 0.5)
observers = celestia:getobservers()
observers[1]:splitview("H", 0.5)
observers[2]:splitview("H", 0.5)
observers = celestia:getobservers()
wait(5.0)
observers[3]:deleteview()


Back to CEL command index