Lua access to ships in system

Post Reply
clausimu
Posts: 105
Joined: Tue Jan 06, 2015 8:31 pm

Lua access to ships in system

Post by clausimu » Tue Jan 06, 2015 8:47 pm

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

jpab
Posts: 77
Joined: Thu Jul 18, 2013 12:30 pm
Location: UK

Re: Lua access to ships in system

Post by jpab » Wed Jan 07, 2015 3:04 pm

The Ship class derives from Body. So, for ships, the objects returned by Space.GetBodies() will be Ship objects.

clausimu
Posts: 105
Joined: Tue Jan 06, 2015 8:31 pm

Re: Lua access to ships in system

Post by clausimu » Wed Jan 07, 2015 6:13 pm

Thank you - I don't know how I missed that. Just tried and you are right. Thank you for the quick reply!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest