Home

Module ship

Lua bindings to interact with ships.

This will allow you to create and manipulate ships in-game.

An example would be:

 s = ship.get( "Empire Lancelot" ) -- Gets the ship
 cpu_free = s:cpu() -- Gets the CPU
 

Functions

__eq (s1, s2) Checks to see if two ships are the same.
get (s) Gets a ship.
name (s) Gets the name of the ship.
baseType (s) Gets the ship's base type.
class (s) Gets the name of the ship's class.
slots (s) Gets the amount of the ship's slots.
getSlots (s) Get a table of slots of a ship, where a slot is a table with a string size, type, and property
cpu (s) Gets the ship available CPU.
price (s) Gets the ship's price, with and without default outfits.
gfxTarget (s) Gets the ship's target graphics.
gfx (s) Gets the ship's graphics.


Functions

__eq (s1, s2)
Checks to see if two ships are the same. ( s1, s2 )

Parameters:

  • s1 Ship First ship to compare.
  • s2 Ship Second ship to compare.

Returns:

    boolean true if both ships are the same.

Usage:

    if s1 == s2 then -- Checks to see if ship s1 and s2 are the same
get (s)
Gets a ship. ( s )

Parameters:

  • s string Name of the ship to get.

Returns:

    Ship The ship matching name or nil if error.

Usage:

    s = ship.get( "Hyena" ) -- Gets the hyena
name (s)
Gets the name of the ship. ( s )

Parameters:

  • s Ship Ship to get ship name.

Returns:

    string The name of the ship.

Usage:

    shipname = s:name()
baseType (s)
Gets the ship's base type.

For example "Empire Lancelot" and "Lancelot" are both of the base type "Lancelot". ( s )

Parameters:

  • s Ship Ship to get the ship base type.

Returns:

    string The name of the ship base type.

Usage:

    type = s:baseType()
class (s)
Gets the name of the ship's class. ( s )

Parameters:

  • s Ship Ship to get ship class name.

Returns:

    string The name of the ship's class.

Usage:

    shipclass = s:class()
slots (s)
Gets the amount of the ship's slots. ( s )

Parameters:

  • s Ship Ship to get ship slots of.

Returns:

  1. number Number of weapon slots.
  2. number Number of utility slots.
  3. number Number of structure slots.

Usage:

    slots_weapon, slots_utility, slots_structure = p:slots()
getSlots (s)
Get a table of slots of a ship, where a slot is a table with a string size, type, and property ( s )

Parameters:

  • s Ship to get slots of

Returns:

    A table of tables with slot properties string "size", string "type", and string "property"

Usage:

    for _,v in ipairs( ship.getSlots( ship.get("Llama") ) ) do print(v["type"]) end
cpu (s)
Gets the ship available CPU. ( s )

Parameters:

  • s Ship Ship to get available CPU of.

Returns:

    number The CPU available on the ship.

Usage:

    cpu_left = s:cpu()
price (s)
Gets the ship's price, with and without default outfits. ( s )

Parameters:

  • s Ship Ship to get the price of.

Returns:

  1. number The ship's final purchase price.
  2. number The ship's base price.

Usage:

    price, base = s:price()
gfxTarget (s)
Gets the ship's target graphics.

Will not work without access to the Tex module. ( s )

Parameters:

  • s Ship Ship to get target graphics of.

Returns:

    Tex The target graphics of the ship.

Usage:

    gfx = s:gfxTarget()
gfx (s)
Gets the ship's graphics.

Will not work without access to the Tex module. These are nearly always a sprite sheet. ( s )

Parameters:

  • s Ship Ship to get graphics of.

Returns:

    Tex The graphics of the ship.

Usage:

    gfx = s:gfx()
generated by LDoc 1.4.3 Last updated 2020-03-30 00:45:13