# QuestionChanging input focus via a Lua script

#### dmurley

##### New member
Is there a way to change the input focus (to a different vessel) using a Lua script.

I hope nobody minds that I'm going to have a lot of beginner questions.

Thanks.

#### dgatsoulis

##### ele2png user
Is there a way to change the input focus (to a different vessel) using a Lua script.

I hope nobody minds that I'm going to have a lot of beginner questions.

Thanks.

No worries, even those that can answer your questions were beginners once.

Sure, you can change the input focus, or get/send inputs to multiple vessels.

Check the html\orbiter.chm help file, in the Orbiter Scripting/Script functions/Vessel access methods section for info.

You can, for example, select two vessels by their names.
Code:
v1 = vessel.get_interface("shipA")
v2 = vessel.get_interface("shipB")

m1 = v1:get_mass()
m2 = v2:get_mass()

In the example above, you have two vessels in the scenario (named shipA and shipB).
m1 and m2 will return shipA's and shipB's mass respectively.

To a beginner, I highly recommend checking out the lua code of the default Orbiter challenges in the Script\Challenges directory (also pretty much every .lua file you can find in the Script directory).

You'll also find some lua assisted tutorials and challenges in the "Tutorials and Challenges" sub-section of the forum.

Hope this helps,

Welcome to the forums