Page 1 of 1

Lua access to ships in system

Posted: Tue Jan 06, 2015 8:47 pm
by clausimu
Hello,

I've been looking into mission scripting by spending some time in the in-game console (to better understand concepts etc.). I have gotten most information about the game-specific lua API from this page: http://eatenbyagrue.org/f/pioneer/codedoc.
I can pull most of the basic information (player, player ship info, bodies, paths, etc.). But what I simply could not figure out is how to access all active ships. I can get a list via space.getbodies(). But I would like to access the actual ship class for each ship (like I can for the player ship via game.player), not just the physical body class. What am I missing? Probably something really simple...

Thank you for a great game,
Claudius

Re: Lua access to ships in system

Posted: Wed Jan 07, 2015 3:04 pm
by jpab
The Ship class derives from Body. So, for ships, the objects returned by Space.GetBodies() will be Ship objects.

Re: Lua access to ships in system

Posted: Wed Jan 07, 2015 6:13 pm
by clausimu
Thank you - I don't know how I missed that. Just tried and you are right. Thank you for the quick reply!