naev 0.12.5
nlua_player.c File Reference

Lua player module. More...

#include "nlua_player.h"
#include "array.h"
#include "board.h"
#include "camera.h"
#include "comm.h"
#include "event.h"
#include "gui.h"
#include "gui_omsg.h"
#include "hook.h"
#include "info.h"
#include "land.h"
#include "land_outfits.h"
#include "map.h"
#include "map_overlay.h"
#include "menu.h"
#include "mission.h"
#include "ndata.h"
#include "nlua_colour.h"
#include "nlua_commodity.h"
#include "nlua_misn.h"
#include "nlua_outfit.h"
#include "nlua_pilot.h"
#include "nlua_ship.h"
#include "nlua_spob.h"
#include "nlua_system.h"
#include "nlua_time.h"
#include "nlua_vec2.h"
#include "nluadef.h"
#include "pause.h"
#include "player.h"
#include "player_autonav.h"
#include "player_fleet.h"
#include "player_gui.h"
#include "player_inventory.h"
#include "rng.h"
#include "save.h"
#include "sound.h"
#include "start.h"
Include dependency graph for nlua_player.c:

Go to the source code of this file.

Macros

#define PLAYER_CHECK()

Functions

static int playerL_getname (lua_State *L)
 Lua bindings to interact with the player.
static int playerL_shipname (lua_State *L)
 Gets the player's ship's name (given by the player).
static int playerL_pay (lua_State *L)
 Pays the player an amount of money.
static int playerL_credits (lua_State *L)
 Gets how many credits the player has on him.
static int playerL_wealth (lua_State *L)
 Gets how many credits the player owns both directly, and in the form of assets (ships, outfits, ...).
static int playerL_msg (lua_State *L)
 Sends the player an in-game message.
static int playerL_msgClear (lua_State *L)
 Clears the player's message buffer.
static int playerL_msgToggle (lua_State *L)
 Clears the player's message buffer.
static int playerL_omsgAdd (lua_State *L)
 Adds an overlay message.
static int playerL_omsgChange (lua_State *L)
 Changes an overlay message.
static int playerL_omsgRm (lua_State *L)
 Removes an overlay message.
static int playerL_allowSave (lua_State *L)
 Sets player save ability.
static int playerL_getPosition (lua_State *L)
 Gets the player's position.
static int playerL_getPilot (lua_State *L)
 Gets the player's associated pilot.
static int playerL_jumps (lua_State *L)
 Gets a player's jump range based on their remaining fuel.
static int playerL_fuel (lua_State *L)
 Gets the amount of fuel a player has.
static int playerL_refuel (lua_State *L)
 Refuels the player.
static int playerL_autonav (lua_State *L)
 Checks to see if the player has autonav enabled.
static int playerL_autonavSetSpeed (lua_State *L)
 Sets the autonav speed.
static int playerL_autonavSetTarget (lua_State *L)
 Set the autonav target system to travel to.
static int playerL_autonavSetPos (lua_State *L)
 Indicates the player where their autonav target position is.
static int playerL_autonavRoute (lua_State *L)
 Gets the player's autonav route.
static int playerL_autonavDest (lua_State *L)
 Gets the player's long term autonav destination.
static int playerL_autonavAbort (lua_State *L)
 Stops the players autonav if active.
static int playerL_autonavReset (lua_State *L)
 Resets the game speed without disabling autonav.
static int playerL_autonavEnd (lua_State *L)
 Ends the autonav system. You probably want to use player.autonavAbort instead of this.
static int playerL_dt_default (lua_State *L)
 Gets the current time modifier for the player.
static int playerL_speed (lua_State *L)
 Gets the current speed of the player.
static int playerL_setSpeed (lua_State *L)
 Sets the game speed directly.
static int playerL_cinematics (lua_State *L)
 Puts the game in cinematics mode or back to regular mode.
static int playerL_cinematicsCheck (lua_State *L)
 Checks to see if the game is in cinematics mode.
static int playerL_damageSPFX (lua_State *L)
 Applies the damage effects to the player.
static int playerL_screenshot (lua_State *L)
 Takes a screenshot (same as the keyboard action).
static int playerL_tryBoard (lua_State *L)
 Tries to make the player board their target.
static int playerL_unboard (lua_State *L)
 Unboards the player from its boarded target.
static int playerL_isLanded (lua_State *L)
 Checks to see if the player is landed or not.
static int playerL_takeoff (lua_State *L)
 Forces the player to take off if they are landed.
static int playerL_tryLand (lua_State *L)
 Tries to make the player land.
static int playerL_land (lua_State *L)
 Automagically lands the player on a spob.
static int playerL_landAllow (lua_State *L)
 Allows or disallows the player to land.
static int playerL_landWindow (lua_State *L)
 Sets the active land window.
static int playerL_commOpen (lua_State *L)
 Opens communication with a pilot or spob.
static int playerL_commClose (lua_State *L)
 Forces the player to close comm if they are chatting.
static int playerL_shipvarPeek (lua_State *L)
 Peeks at a ship variable.
static int playerL_shipvarPush (lua_State *L)
 Pushes a ship variable.
static int playerL_shipvarPop (lua_State *L)
 Pops a ship variable.
static int playerL_ships (lua_State *L)
 Gets the names of the player's ships.
static int playerL_shipOutfits (lua_State *L)
 Gets the outfits for one of the player's ships.
static int playerL_shipMetadata (lua_State *L)
 Gets meta-data about one of the player's ships.
static int playerL_shipDeploy (lua_State *L)
 Sets the deployed status of a player's ship.
static int playerL_outfits (lua_State *L)
 Gets all the outfits the player owns.
static int playerL_outfitNum (lua_State *L)
 Gets the number of outfits the player owns in their list (excludes equipped on ships).
static int playerL_outfitAdd (lua_State *L)
 Adds an outfit to the player's outfit list.
static int playerL_outfitRm (lua_State *L)
 Removes an outfit from the player's outfit list.
static int playerL_shipAdd (lua_State *L)
 Gives the player a new ship.
static int playerL_shipSwap (lua_State *L)
 Swaps the player's current ship with a ship they own by name.
static int playerL_missions (lua_State *L)
 Gets the list of the player's active missions.
static int playerL_misnActive (lua_State *L)
 Checks to see if the player has a mission active.
static int playerL_misnDone (lua_State *L)
 Checks to see if player has done a mission.
static int playerL_misnDoneList (lua_State *L)
 Gets a list of all the missions the player has done.
static int playerL_evtActive (lua_State *L)
 Checks to see if the player has an event active.
static int playerL_evtDone (lua_State *L)
 Checks to see if player has done an event.
static int playerL_evtDoneList (lua_State *L)
 Gets a list of all the events the player has done.
static int playerL_gui (lua_State *L)
 Gets the player's current GUI.
static int playerL_guiList (lua_State *L)
 Lists the GUIs the player can use.
static int playerL_guiSet (lua_State *L)
 Sets the player's GUI.
static int playerL_fleetList (lua_State *L)
 Lists the ships in the player's fleet.
static int playerL_fleetCargoFree (lua_State *L)
 Gets the amount of cargo space free in the player's fleet.
static int playerL_fleetCargoMissionFree (lua_State *L)
 Gets the free space for mission cargos on the player's ship. This can be less than the amount of free space in the player's fleet since the other fleet ships can not carry mission cargo.
static int playerL_fleetCargoUsed (lua_State *L)
 Gets the amount of cargo space used in the player's fleet.
static int playerL_fleetCargoOwned (lua_State *L)
 Gets the amount of cargo space used by a specific commodity in the player's fleet.
static int playerL_fleetCargoAdd (lua_State *L)
 Tries to add an amount of commodity to the player's fleet.
static int playerL_fleetCargoRm (lua_State *L)
 Tries to remove an amount of commodity to the player's fleet.
static int playerL_fleetCargoJet (lua_State *L)
 Tries to remove an amount of commodity to the player's fleet and jettisons it into space.
static int playerL_fleetCargoList (lua_State *L)
 Gets the list of all the cargos in the player's fleet.
static int playerL_inventory (lua_State *L)
 Gets the contents of the player's inventory.
static int playerL_inventoryAdd (lua_State *L)
 Adds an item to the player's in-game inventory.
static int playerL_inventoryRm (lua_State *L)
 Removes an item to the player's in-game inventory.
static int playerL_inventoryOwned (lua_State *L)
 Checks to see how much of an item the player has in their inventory.
static int playerL_teleport (lua_State *L)
 Teleports the player to a new spob or system (only if not landed).
static int playerL_dt_mod (lua_State *L)
 Gets the dt_mod of the player, which multiplies all time stuff.
static int playerL_fleetCapacity (lua_State *L)
 Gets the fleet capacity (and used) of the player.
static int playerL_fleetCapacitySet (lua_State *L)
 Sets the fleet capacity of the player.
static int playerL_chapter (lua_State *L)
 Gets the player's current chapter.
static int playerL_chapterSet (lua_State *L)
 Sets the player's current chapter.
static int playerL_infoButtonRegister (lua_State *L)
 Registers a button in the info window.
static int playerL_infoButtonUnregister (lua_State *L)
 Unregisters a button in the info window.
static int playerL_canDiscover (lua_State *L)
 Global toggle to whether or not the player can discover space objects and jumps. Meant to be used with cutscenes that use player.teleport().
static int playerL_save (lua_State *L)
 Saves the game.
static int playerL_saveBackup (lua_State *L)
 Backs up the player's last autosave with a custom name.
static int playerL_gameover (lua_State *L)
 Gives the player a game over message.
static int playerL_start (lua_State *L)
 Gets information about the player's starting point.
int nlua_loadPlayer (nlua_env env)
 Loads the player Lua library.
static PlayerShip_tplayerL_shipvarShip (lua_State *L, int idx)

Variables

static const luaL_Reg playerL_methods []

Detailed Description

Lua player module.

Definition in file nlua_player.c.

Macro Definition Documentation

◆ PLAYER_CHECK

#define PLAYER_CHECK ( )
Value:
if ( player.p == NULL ) \
return 0
Player_t player
Definition player.c:77

Definition at line 59 of file nlua_player.c.

Function Documentation

◆ nlua_loadPlayer()

int nlua_loadPlayer ( nlua_env env)

Loads the player Lua library.

Parameters
envLua environment.

Definition at line 269 of file nlua_player.c.

◆ playerL_allowSave()

int playerL_allowSave ( lua_State * L)
static

Sets player save ability.

Lua usage parameter: player.allowSave( b ) Lua function parameter:[opt=true] boolean b true if the player is allowed to save, false otherwise.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: allowSave

Definition at line 571 of file nlua_player.c.

◆ playerL_autonav()

int playerL_autonav ( lua_State * L)
static

Checks to see if the player has autonav enabled.

Lua usage parameter: autonav = player.autonav() Lua return parameter: boolean true if the player has autonav enabled. Lua return parameter: number Speed of the current autonav.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: autonav

Definition at line 687 of file nlua_player.c.

◆ playerL_autonavAbort()

int playerL_autonavAbort ( lua_State * L)
static

Stops the players autonav if active.

Lua usage parameter: sys, jumps = player.autonavAbort()

Note
Does not do anything if the player is not in autonav.

Lua function parameter:[opt] string msg Abort message.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: autonavAbort

Definition at line 812 of file nlua_player.c.

◆ playerL_autonavDest()

int playerL_autonavDest ( lua_State * L)
static

Gets the player's long term autonav destination.

Lua usage parameter: sys, jumps = player.autonavDest()

Lua return parameter: System|nil The destination system (or nil if none selected). Lua return parameter: number|nil The number of jumps left.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: autonavDest

Definition at line 763 of file nlua_player.c.

◆ playerL_autonavEnd()

int playerL_autonavEnd ( lua_State * L)
static

Ends the autonav system. You probably want to use player.autonavAbort instead of this.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: autonavEnd

See also
autonavAbort

Definition at line 844 of file nlua_player.c.

◆ playerL_autonavReset()

int playerL_autonavReset ( lua_State * L)
static

Resets the game speed without disabling autonav.

Note
Does not do anything if the player is not in autonav.

Lua function parameter:[opt=0.] number timer How many seconds to wait before starting autonav up again.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: autonavReset

Definition at line 829 of file nlua_player.c.

◆ playerL_autonavRoute()

int playerL_autonavRoute ( lua_State * L)
static

Gets the player's autonav route.

Lua usage parameter: syslist = player.autonavRoute()

Lua return parameter: Table A table of systems indicating the route of the player.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: autonavRoute

Definition at line 789 of file nlua_player.c.

◆ playerL_autonavSetPos()

int playerL_autonavSetPos ( lua_State * L)
static

Indicates the player where their autonav target position is.

Lua function parameter: Vec2|nil pos Position to mark as autonav destination or nil to clear.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: autonavSetPos

Definition at line 743 of file nlua_player.c.

◆ playerL_autonavSetSpeed()

int playerL_autonavSetSpeed ( lua_State * L)
static

Sets the autonav speed.

Definition at line 698 of file nlua_player.c.

◆ playerL_autonavSetTarget()

int playerL_autonavSetTarget ( lua_State * L)
static

Set the autonav target system to travel to.

Lua function parameter: StarSystem sys Star system to set as autonav target. Lua function parameter: boolean add Whether or not this should be added to the current route.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: autonavSetTarget

Definition at line 722 of file nlua_player.c.

◆ playerL_canDiscover()

int playerL_canDiscover ( lua_State * L)
static

Global toggle to whether or not the player can discover space objects and jumps. Meant to be used with cutscenes that use player.teleport().

Lua function parameter:[opt=false] Whether or not the player can discover objects.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: canDiscover

Definition at line 2644 of file nlua_player.c.

◆ playerL_chapter()

int playerL_chapter ( lua_State * L)
static

Gets the player's current chapter.

Lua return parameter: string The player's current chapter.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: chapter

Definition at line 2575 of file nlua_player.c.

◆ playerL_chapterSet()

int playerL_chapterSet ( lua_State * L)
static

Sets the player's current chapter.

Lua function parameter: string chapter The name of the chapter to set the player to.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: chapterSet

Definition at line 2588 of file nlua_player.c.

◆ playerL_cinematics()

int playerL_cinematics ( lua_State * L)
static

Puts the game in cinematics mode or back to regular mode.

Possible options are:

  • abort : (string) autonav abort message
  • no2x : (boolean) whether to prevent the player from increasing the speed, default false
  • gui : (boolean) enables the player's gui, default disabled

Lua usage parameter: player.cinematics( true, { gui = true } ) – Enables cinematics without hiding gui.

Lua function parameter: boolean enable If true sets cinematics mode, if false disables. Defaults to disable. Lua function parameter: table options Table of options.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: cinematics

Definition at line 922 of file nlua_player.c.

◆ playerL_cinematicsCheck()

int playerL_cinematicsCheck ( lua_State * L)
static

Checks to see if the game is in cinematics mode.

Definition at line 997 of file nlua_player.c.

◆ playerL_commClose()

int playerL_commClose ( lua_State * L)
static

Forces the player to close comm if they are chatting.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: commClose

Definition at line 1331 of file nlua_player.c.

◆ playerL_commOpen()

int playerL_commOpen ( lua_State * L)
static

Opens communication with a pilot or spob.

Will do no checks with spobs.

Lua function parameter: Pilot|Spob Target to open communication channel with. Lua return parameter: boolean true on success, false if failed to open.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: commOpen

Definition at line 1309 of file nlua_player.c.

◆ playerL_credits()

int playerL_credits ( lua_State * L)
static

Gets how many credits the player has on him.

Lua usage parameter: monies = player.credits() Lua usage parameter: monies, readable = player.credits( 2 )

Lua function parameter:[opt] number decimal Optional argument that makes it return human readable form with so many decimals. Lua return parameter: number The amount of credits in numerical form. Lua return parameter: string The amount of credits in human-readable form.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: credits

Definition at line 371 of file nlua_player.c.

◆ playerL_damageSPFX()

int playerL_damageSPFX ( lua_State * L)
static

Applies the damage effects to the player.

Lua function parameter: number mod How strong the effect should be. It should be a value between 0 and 1, usually corresponding to how much armour damage the player has taken with respect to their total armour.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: damageSPFX

Definition at line 1011 of file nlua_player.c.

◆ playerL_dt_default()

int playerL_dt_default ( lua_State * L)
static

Gets the current time modifier for the player.

Lua return parameter: number Current time modifier.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: dt_defaults

Definition at line 858 of file nlua_player.c.

◆ playerL_dt_mod()

int playerL_dt_mod ( lua_State * L)
static

Gets the dt_mod of the player, which multiplies all time stuff.

Lua return parameter: number The dt_mod of the player.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: dt_mod

Definition at line 2523 of file nlua_player.c.

◆ playerL_evtActive()

int playerL_evtActive ( lua_State * L)
static

Checks to see if the player has an event active.

Lua usage parameter: if player.evtActive( "Shipwreck" ) then – The shipwreck event is active

Lua function parameter: string name Name of the mission to check. Lua return parameter: boolean true if the mission is active, false if it isn't.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: evtActive

Definition at line 1981 of file nlua_player.c.

◆ playerL_evtDone()

int playerL_evtDone ( lua_State * L)
static

Checks to see if player has done an event.

This only works with events that have the unique flag.

Lua usage parameter: if player.evtDone( "Shipwreck" ) then – Player finished event Lua function parameter: string name Name of the event to check. Lua return parameter: boolean true if event was finished, false if it wasn't.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: evtDone

Definition at line 2002 of file nlua_player.c.

◆ playerL_evtDoneList()

int playerL_evtDoneList ( lua_State * L)
static

Gets a list of all the events the player has done.

Lua return parameter: table List of all the events the player has done.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: evtDoneList

Definition at line 2019 of file nlua_player.c.

◆ playerL_fleetCapacity()

int playerL_fleetCapacity ( lua_State * L)
static

Gets the fleet capacity (and used) of the player.

Lua return parameter: number Total fleet capacity of the player. Lua return parameter: number Currently used fleet capacity of the player. Lua return parameter: boolean Can take off.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: fleetCapacity

Definition at line 2537 of file nlua_player.c.

◆ playerL_fleetCapacitySet()

int playerL_fleetCapacitySet ( lua_State * L)
static

Sets the fleet capacity of the player.

Lua function parameter: number capacity Fleet capacity to set the player to.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: fleetCapacitySet

Definition at line 2562 of file nlua_player.c.

◆ playerL_fleetCargoAdd()

int playerL_fleetCargoAdd ( lua_State * L)
static

Tries to add an amount of commodity to the player's fleet.

Lua function parameter: Commodity c Commodity to add to the player fleet. Lua function parameter: number q Amount to add. Lua return parameter: number Amount of commodity added to the player fleet.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: fleetCargoAdd

Definition at line 2192 of file nlua_player.c.

◆ playerL_fleetCargoFree()

int playerL_fleetCargoFree ( lua_State * L)
static

Gets the amount of cargo space free in the player's fleet.

Lua return parameter: number Amount of free cargo space.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: fleetCargoFree

Definition at line 2123 of file nlua_player.c.

◆ playerL_fleetCargoJet()

int playerL_fleetCargoJet ( lua_State * L)
static

Tries to remove an amount of commodity to the player's fleet and jettisons it into space.

Lua function parameter: Commodity c Commodity to remove from the player fleet. Lua function parameter: number q Amount to remove. Lua return parameter: number Amount of commodity removed from the player fleet.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: fleetCargoJet

Definition at line 2231 of file nlua_player.c.

◆ playerL_fleetCargoList()

int playerL_fleetCargoList ( lua_State * L)
static

Gets the list of all the cargos in the player's fleet.

Lua usage parameter: for k,v in ipairs( player.fleetCargoList() ) do print( v.c, v.q ) end

Lua return parameter: table A table containing table entries of the form {c = commodity, q = quantity }.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: fleetCargoList

Definition at line 2251 of file nlua_player.c.

◆ playerL_fleetCargoMissionFree()

int playerL_fleetCargoMissionFree ( lua_State * L)
static

Gets the free space for mission cargos on the player's ship. This can be less than the amount of free space in the player's fleet since the other fleet ships can not carry mission cargo.

Lua return parameter: number Amount of free cargo space for mission cargos.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: fleetCargoMissionFree

Definition at line 2140 of file nlua_player.c.

◆ playerL_fleetCargoOwned()

int playerL_fleetCargoOwned ( lua_State * L)
static

Gets the amount of cargo space used by a specific commodity in the player's fleet.

Lua function parameter: Commodity c Commodity to check how much the player has in their fleet. Lua return parameter: number Amount of used cargo space for the commodity.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: fleetCargoOwned

Definition at line 2174 of file nlua_player.c.

◆ playerL_fleetCargoRm()

int playerL_fleetCargoRm ( lua_State * L)
static

Tries to remove an amount of commodity to the player's fleet.

Lua function parameter: Commodity c Commodity to remove from the player fleet. Lua function parameter: number q Amount to remove. Lua return parameter: number Amount of commodity removed from the player fleet.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: fleetCargoRm

Definition at line 2211 of file nlua_player.c.

◆ playerL_fleetCargoUsed()

int playerL_fleetCargoUsed ( lua_State * L)
static

Gets the amount of cargo space used in the player's fleet.

Lua return parameter: number Amount of used cargo space.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: fleetCargoUsed

Definition at line 2156 of file nlua_player.c.

◆ playerL_fleetList()

int playerL_fleetList ( lua_State * L)
static

Lists the ships in the player's fleet.

Lua return parameter: table Table containing the pilots in the player fleet or false if they are not spawned yet.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: fleetList

Definition at line 2090 of file nlua_player.c.

◆ playerL_fuel()

int playerL_fuel ( lua_State * L)
static

Gets the amount of fuel a player has.

Lua usage parameter: fuel, consumption = player.fuel()

Lua return parameter: number The player's fuel and Lua return parameter: number The amount of fuel needed per jump.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: fuel

Definition at line 642 of file nlua_player.c.

◆ playerL_gameover()

int playerL_gameover ( lua_State * L)
static

Gives the player a game over message.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: gameover

Definition at line 2710 of file nlua_player.c.

◆ playerL_getname()

int playerL_getname ( lua_State * L)
static

Lua bindings to interact with the player.

These bindings let you modify stuff about the player and find out special information. General usage would be calls like:

pname = player.name()
shipname = player.ship()

Lua module: player

Gets the player's name.

Lua return parameter: string The name of the player.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: name

Definition at line 292 of file nlua_player.c.

◆ playerL_getPilot()

int playerL_getPilot ( lua_State * L)
static

Gets the player's associated pilot.

Lua return parameter: Pilot The player's pilot.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: pilot

Definition at line 608 of file nlua_player.c.

◆ playerL_getPosition()

int playerL_getPosition ( lua_State * L)
static

Gets the player's position.

Lua usage parameter: v = player.pos()

Lua return parameter: Vec2 The position of the player.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: pos

Definition at line 595 of file nlua_player.c.

◆ playerL_gui()

int playerL_gui ( lua_State * L)
static

Gets the player's current GUI.

Lua return parameter: string The player's current GUI.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: gui

Definition at line 2040 of file nlua_player.c.

◆ playerL_guiList()

int playerL_guiList ( lua_State * L)
static

Lists the GUIs the player can use.

Lua return parameter: table Table containing the names of all the GUIs the player can use.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: guiList

Definition at line 2053 of file nlua_player.c.

◆ playerL_guiSet()

int playerL_guiSet ( lua_State * L)
static

Sets the player's GUI.

Lua return parameter: string The player's current GUI.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: guiSet

Definition at line 2072 of file nlua_player.c.

◆ playerL_infoButtonRegister()

int playerL_infoButtonRegister ( lua_State * L)
static

Registers a button in the info window.

Lua function parameter: string caption Caption of the button. Lua function parameter: function func Function to run when clicked. Lua function parameter:[opt] number priority Button priority, lower is more important. Lua function parameter:[opt] string key Hotkey for using the button without it being focused. Lua return parameter: number ID of the info window button for use with player.infoButtonUnregister.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: infoButtonRegister

Definition at line 2609 of file nlua_player.c.

◆ playerL_infoButtonUnregister()

int playerL_infoButtonUnregister ( lua_State * L)
static

Unregisters a button in the info window.

Lua function parameter: number ID of the button to unregister.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: infoButtonUnregister

Definition at line 2628 of file nlua_player.c.

◆ playerL_inventory()

int playerL_inventory ( lua_State * L)
static

Gets the contents of the player's inventory.

Note that this does not get licenses.

Lua return parameter: table A table containing inventory items in the form of subtables with a "name" and "quantity" field.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: inventory

Definition at line 2288 of file nlua_player.c.

◆ playerL_inventoryAdd()

int playerL_inventoryAdd ( lua_State * L)
static

Adds an item to the player's in-game inventory.

Lua function parameter: string name The name of the item to add. Lua function parameter: integer quantity The amount of the item to add. Lua return parameter: integer The amount of the item added.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: inventoryAdd

Definition at line 2319 of file nlua_player.c.

◆ playerL_inventoryOwned()

int playerL_inventoryOwned ( lua_State * L)
static

Checks to see how much of an item the player has in their inventory.

Lua function parameter: string name The name of the item to check. Lua return parameter: integer The amount of the item the player has (0 if none).

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: inventoryAdd

Definition at line 2356 of file nlua_player.c.

◆ playerL_inventoryRm()

int playerL_inventoryRm ( lua_State * L)
static

Removes an item to the player's in-game inventory.

Lua function parameter: string name The name of the item to remove. Lua function parameter: integer quantity The amount of the item to remove. Lua return parameter: integer The amount of the item removed.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: inventoryAdd

Definition at line 2338 of file nlua_player.c.

◆ playerL_isLanded()

int playerL_isLanded ( lua_State * L)
static

Checks to see if the player is landed or not.

Lua return parameter: boolean Whether or not the player is currently landed.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: isLanded

Definition at line 1081 of file nlua_player.c.

◆ playerL_jumps()

int playerL_jumps ( lua_State * L)
static

Gets a player's jump range based on their remaining fuel.

Lua usage parameter: jumps = player.jumps()

Lua return parameter: number The player's maximum number of jumps.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: jumps

Definition at line 624 of file nlua_player.c.

◆ playerL_land()

int playerL_land ( lua_State * L)
static

Automagically lands the player on a spob.

Note that this will teleport the player to the system in question as necessary.

Lua function parameter: Spob spb Spob to land the player on.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: land

Definition at line 1147 of file nlua_player.c.

◆ playerL_landAllow()

int playerL_landAllow ( lua_State * L)
static

Allows or disallows the player to land.

This will allow or disallow landing on a system level and is reset when the player enters another system.

Lua usage parameter: player.landAllow() – Allows the player to land Lua usage parameter: player.landAllow( false ) – Doesn't allow the player to land. Lua usage parameter: player.landAllow( false, "No landing." ) – Doesn't allow the player to land with the message "No landing."

Lua function parameter:[opt=true] boolean b Whether or not to allow the player to land. Lua function parameter:[opt] string msg Message displayed when player tries to land (only if disallowed to land). Can be omitted to use default.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: landAllow

Definition at line 1227 of file nlua_player.c.

◆ playerL_landWindow()

int playerL_landWindow ( lua_State * L)
static

Sets the active land window.

Valid windows are:

  • main
  • bar
  • missions
  • outfits
  • shipyard
  • equipment
  • commodity

Lua usage parameter: player.landWindow( "outfits" ) Lua function parameter: string winname Name of the window. Lua return parameter: boolean True on success.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: landWindow

Definition at line 1265 of file nlua_player.c.

◆ playerL_misnActive()

int playerL_misnActive ( lua_State * L)
static

Checks to see if the player has a mission active.

Lua usage parameter: if player.misnActive( "The Space Family" ) then – Player is doing space family mission

Lua function parameter: string name Name of the mission to check. Lua return parameter: boolean|number Number of instances if the mission is active, false if it isn't.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: misnActive

Definition at line 1913 of file nlua_player.c.

◆ playerL_misnDone()

int playerL_misnDone ( lua_State * L)
static

Checks to see if player has done a mission.

This only works with missions that have the unique flag.

Lua usage parameter: if player.misnDone( "The Space Family" ) then – Player finished mission Lua function parameter: string name Name of the mission to check. Lua return parameter: boolean true if mission was finished, false if it wasn't.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: misnDone

Definition at line 1939 of file nlua_player.c.

◆ playerL_misnDoneList()

int playerL_misnDoneList ( lua_State * L)
static

Gets a list of all the missions the player has done.

Lua return parameter: table List of all the missions the player has done.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: misnDoneList

Definition at line 1956 of file nlua_player.c.

◆ playerL_missions()

int playerL_missions ( lua_State * L)
static

Gets the list of the player's active missions.

Lua usage parameter: n = #player.missions() – number of active missions

Lua return parameter: table Table containing the metadat of active missions as tables. Fields include "name", "desc", "reward", "loc", "chance", "spob", "system", "chapter", "cond", "done", "priority", "unique", and "tags".

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: missions

Definition at line 1834 of file nlua_player.c.

◆ playerL_msg()

int playerL_msg ( lua_State * L)
static

Sends the player an in-game message.

Lua function parameter: string message Message to send the player. Lua function parameter:[opt=false] boolean display Display the message over the player's ship (like a broadcast message).

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: msg

Definition at line 440 of file nlua_player.c.

◆ playerL_msgClear()

int playerL_msgClear ( lua_State * L)
static

Clears the player's message buffer.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: msgClear

Definition at line 457 of file nlua_player.c.

◆ playerL_msgToggle()

int playerL_msgToggle ( lua_State * L)
static

Clears the player's message buffer.

Lua function parameter:( boolean enable Whether or not to enable the player receiving messages.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: msgToggle

Definition at line 471 of file nlua_player.c.

◆ playerL_omsgAdd()

int playerL_omsgAdd ( lua_State * L)
static

Adds an overlay message.

Lua usage parameter: player.omsgAdd( "some_message", 5 ) Lua function parameter: string msg Message to add. Lua function parameter:[opt=10] number duration Duration to add message in seconds (if

  1. the duration is infinite). Lua function parameter:[opt=16] number fontsize Size of the font to use. Lua function parameter:[opt=white] Colour col Colour to use for the text or white if not specified. Lua return parameter: number ID of the created overlay message.
    Parameters
    LLua State
    Returns
    Number of variables on the Lua State stack.
    Lua function: omsgAdd

Definition at line 490 of file nlua_player.c.

◆ playerL_omsgChange()

int playerL_omsgChange ( lua_State * L)
static

Changes an overlay message.

Lua usage parameter: player.omsgChange( omsg_id, "new message", 3 ) Lua function parameter: number id ID of the overlay message to change. Lua function parameter: string msg Message to change to. Lua function parameter: number duration New duration to set in seconds (0. for infinity). Lua return parameter: boolean true if all went well, false otherwise.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: omsgChange

Definition at line 526 of file nlua_player.c.

◆ playerL_omsgRm()

int playerL_omsgRm ( lua_State * L)
static

Removes an overlay message.

Lua usage parameter: player.omsgRm( msg_id ) Lua function parameter: number id ID of the overlay message to remove.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: omsgRm

Definition at line 556 of file nlua_player.c.

◆ playerL_outfitAdd()

int playerL_outfitAdd ( lua_State * L)
static

Adds an outfit to the player's outfit list.

Lua usage parameter: player.outfitAdd( "Laser Cannon" ) – Gives the player a laser cannon Lua usage parameter: player.outfitAdd( "Plasma Blaster", 2 ) – Gives the player two plasma blasters

Lua function parameter: string name Name of the outfit to give. Lua function parameter:[opt=1] number q Quantity to give.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: outfitAdd

Definition at line 1690 of file nlua_player.c.

◆ playerL_outfitNum()

int playerL_outfitNum ( lua_State * L)
static

Gets the number of outfits the player owns in their list (excludes equipped on ships).

Lua usage parameter: q = player.outfitNum( "Laser Cannon MK0", true ) – Number of 'Laser Cannon MK0' the player owns (unequipped)

Lua function parameter: string name Name of the outfit to remove. Lua function parameter:[opt=false] bool unequipped_only Whether or not to check only the unequipped outfits and not equipped outfits. Defaults to false. Lua return parameter: number The quantity the player owns.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: outfitNum

Definition at line 1656 of file nlua_player.c.

◆ playerL_outfitRm()

int playerL_outfitRm ( lua_State * L)
static

Removes an outfit from the player's outfit list.

"all" will remove all outfits.

Lua usage parameter: player.outfitRm( "Plasma Blaster", 2 ) – Removes two plasma blasters from the player

Lua function parameter: string name Name of the outfit to give. Lua function parameter:[opt] number q Quantity to remove (default 1).

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: outfitRm

Definition at line 1718 of file nlua_player.c.

◆ playerL_outfits()

int playerL_outfits ( lua_State * L)
static

Gets all the outfits the player owns.

If you want the quantity, call player.outfitNum() on the individual outfit.

Lua usage parameter: player.outfits() – A table of all the player's outfits.

Lua function parameter:[opt=false] bool unequipped_only Whether or not to check only the unequipped outfits and not equipped outfits. Defaults to false. Lua return parameter: {Outfit,...} Table of outfits.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: outfits

Definition at line 1604 of file nlua_player.c.

◆ playerL_pay()

int playerL_pay ( lua_State * L)
static

Pays the player an amount of money.

Lua usage parameter: player.pay( 500 ) – Gives player 500 credits

Lua function parameter: number amount Amount of money to pay the player in credits. Lua function parameter:[opt] boolean|string nohooks Set to true to not trigger pay hooks, or a string value to pass that to the pay hook instead.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: pay

Definition at line 323 of file nlua_player.c.

◆ playerL_refuel()

int playerL_refuel ( lua_State * L)
static

Refuels the player.

Lua usage parameter: player.refuel() – Refuel fully Lua usage parameter: player.refuel( 200 ) – Refuels partially

Lua function parameter:[opt] number fuel Amount of fuel to add, will set to max if nil.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: refuel

Definition at line 663 of file nlua_player.c.

◆ playerL_save()

int playerL_save ( lua_State * L)
static

Saves the game.

Lua function parameter:[opt="autosave"] string name What to name the save. Lua function parameter:[opt=nil] Spob|string Spob or name of spob to save the player at.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: save

Definition at line 2658 of file nlua_player.c.

◆ playerL_saveBackup()

int playerL_saveBackup ( lua_State * L)
static

Backs up the player's last autosave with a custom name.

Lua function parameter: string name Name to give the copy of the autosave. Lua return parameter: boolean true on success.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: saveBackup

Definition at line 2691 of file nlua_player.c.

◆ playerL_screenshot()

int playerL_screenshot ( lua_State * L)
static

Takes a screenshot (same as the keyboard action).

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: screenshot

Definition at line 1024 of file nlua_player.c.

◆ playerL_setSpeed()

int playerL_setSpeed ( lua_State * L)
static

Sets the game speed directly.

Lua function parameter: number speed Speed to set the game to. If omitted it will reset the game speed. Lua function parameter:[opt=speed] number sound Sound speed to set to. Lua function parameter:[opt=false] boolean noset Avoid setting player.speed. Useful for autonav.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: setSpeed

Definition at line 886 of file nlua_player.c.

◆ playerL_shipAdd()

int playerL_shipAdd ( lua_State * L)
static

Gives the player a new ship.

Note
Should be given when landed, ideally on a spob with a shipyard. Furthermore, this invalidates all player.pilot() references.

Lua usage parameter: player.shipAdd( "Pirate Kestrel", _("Seiryuu"), _("") ) – Gives the player a Pirate Kestrel named Seiryuu if player cancels the naming.

Lua function parameter: string ship Name of the ship to add. Lua function parameter:[opt=ship.get(ship):name()] string name Name to give the ship if player refuses to name it (defaults to shipname if omitted). Lua function parameter:[opt] string acquired A description of how the ship was acquired. Lua function parameter:[opt=false] boolean noname If true does not let the player name the ship. Lua return parameter: string The new ship's name.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: shipAdd

Definition at line 1777 of file nlua_player.c.

◆ playerL_shipDeploy()

int playerL_shipDeploy ( lua_State * L)
static

Sets the deployed status of a player's ship.

Lua function parameter: string shipname Name of the ship to set deployed status of. Lua function parameter:[opt=false] boolean deploy Whether or not to set the deployed status of the ship.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: shipDeploy

Definition at line 1582 of file nlua_player.c.

◆ playerL_shipMetadata()

int playerL_shipMetadata ( lua_State * L)
static

Gets meta-data about one of the player's ships.

Lua function parameter:[nil=Current ship] string name Name of the ship to get the meta-data of. Lua return parameter: Table of meta-data.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: shipMetadata

Definition at line 1507 of file nlua_player.c.

◆ playerL_shipname()

int playerL_shipname ( lua_State * L)
static

Gets the player's ship's name (given by the player).

Note
Not to be confused with getting the player's ship that can be done with player.pilot():ship().

Lua return parameter: string The name of the ship the player is currently in.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: ship

Definition at line 307 of file nlua_player.c.

◆ playerL_shipOutfits()

int playerL_shipOutfits ( lua_State * L)
static

Gets the outfits for one of the player's ships.

Lua usage parameter: outfits = player.shipOutfits("Llama") – Gets the Llama's outfits

Lua function parameter:[nil=Current ship] string name Name of the ship to get the outfits of. Lua return parameter: {Outfit,...} Table of outfits.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: shipOutfits

Definition at line 1451 of file nlua_player.c.

◆ playerL_ships()

int playerL_ships ( lua_State * L)
static

Gets the names of the player's ships.

Lua usage parameter: names = player.ships() – The player's ship names.

Lua return parameter: {String,...} Table of ship names.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: ships

Definition at line 1415 of file nlua_player.c.

◆ playerL_shipSwap()

int playerL_shipSwap ( lua_State * L)
static

Swaps the player's current ship with a ship they own by name.

Note
You shouldn't use this directly unless you know what you are doing. If the player's cargo doesn't fit in the new ship, it won't be moved over and can lead to a whole slew of issues.
This invalidates all player.pilot() references!

Lua function parameter: string ship Name of the ship to swap to. (this is name given by the player, not ship name) Lua function parameter:[opt=false] boolean ignore_cargo Whether or not to ignore cargo and not move it, or try to move it over. Lua function parameter:[opt=false] boolean remove If true removes the player's current ship (so it replaces and doesn't swap).

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: shipSwap

Definition at line 1810 of file nlua_player.c.

◆ playerL_shipvarPeek()

int playerL_shipvarPeek ( lua_State * L)
static

Peeks at a ship variable.

Lua usage parameter: local exp = player.shipvarPeek( "exp" ) – Checks the value of the "exp" ship var on the player's current ship

Lua function parameter: string varname Name of the variable to check value of. Lua function parameter:[opt] string shipname Name of the ship to check variable of. Defaults to player's current ship.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: shipvarPeek

Definition at line 1356 of file nlua_player.c.

◆ playerL_shipvarPop()

int playerL_shipvarPop ( lua_State * L)
static

Pops a ship variable.

Lua function parameter: string varname Name of the variable to pop. Lua function parameter:[opt] string shipname Name of the ship to pop variable from. Defaults to player's current ship.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: shipvarPop

Definition at line 1396 of file nlua_player.c.

◆ playerL_shipvarPush()

int playerL_shipvarPush ( lua_State * L)
static

Pushes a ship variable.

Lua function parameter: string varname Name of the variable to set value of. Lua function parameter: val Value to push. Lua function parameter:[opt] string shipname Name of the ship to push variable to. Defaults to player's current ship.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: shipvarPush

Definition at line 1376 of file nlua_player.c.

◆ playerL_shipvarShip()

PlayerShip_t * playerL_shipvarShip ( lua_State * L,
int idx )
static

Definition at line 1338 of file nlua_player.c.

◆ playerL_speed()

int playerL_speed ( lua_State * L)
static

Gets the current speed of the player.

Lua return parameter: number Current speed modifier.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: sped

Definition at line 870 of file nlua_player.c.

◆ playerL_start()

int playerL_start ( lua_State * L)
static

Gets information about the player's starting point.

Lua return parameter: Returns a table containing the different start information as keys and the corresponding information as values. Fields include things such as "name" for the campaign name, "ship" for the starting ship, "shipname" for the starting shp name, etc. Please refer to dat/start.xml for more details of available fields.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: start

Definition at line 2728 of file nlua_player.c.

◆ playerL_takeoff()

int playerL_takeoff ( lua_State * L)
static

Forces the player to take off if they are landed.

Assume the pilot is still landed until the current running function returns If you want to create pilots on take off please hook the takeoff/land hooks.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: takeoff

Definition at line 1095 of file nlua_player.c.

◆ playerL_teleport()

int playerL_teleport ( lua_State * L)
static

Teleports the player to a new spob or system (only if not landed).

If the destination is a system, the coordinates of the player will not change. If the destination is a spob, the player will be placed over that spob.

Lua usage parameter: player.teleport( system.get("Arcanis") ) – Teleports the player to Arcanis. Lua usage parameter: player.teleport( "Arcanis" ) – Teleports the player to Arcanis. Lua usage parameter: player.teleport( "Dvaer Prime" ) – Teleports the player to Dvaer, and relocates him to Dvaer Prime. Lua usage parameter: player.teleport( "Sol", true ) – Teleports the player to SOL, but doesn't run any initial simulation

Lua function parameter: System|Spob|string dest System or name of a system or spob or name of a spob to teleport the player to. Lua function parameter:[opt=false] boolean no_simulate Don't simulate the when teleporting if true. Lua function parameter:[opt=false] boolean silent Doesn't display any entering system messages.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: teleport

Definition at line 2389 of file nlua_player.c.

◆ playerL_tryBoard()

int playerL_tryBoard ( lua_State * L)
static

Tries to make the player board their target.

Lua function parameter: boolean noisy Whether or not to do player messages. Lua return parameter: string Status of the boarding attempt. Can be "impossible", "retry", "ok", or "error".

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: tryBoard

Definition at line 1039 of file nlua_player.c.

◆ playerL_tryLand()

int playerL_tryLand ( lua_State * L)
static

Tries to make the player land.

Lua function parameter: boolean noisy Whether or not to do player messages. Lua return parameter: string Status of the boarding attempt. Can be "impossible", "retry", "ok", or "error".

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: tryBoard

Definition at line 1118 of file nlua_player.c.

◆ playerL_unboard()

int playerL_unboard ( lua_State * L)
static

Unboards the player from its boarded target.

Use from inside a board hook.

Lua usage parameter: player.unboard()

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: unboard

Definition at line 1068 of file nlua_player.c.

◆ playerL_wealth()

int playerL_wealth ( lua_State * L)
static

Gets how many credits the player owns both directly, and in the form of assets (ships, outfits, ...).

Lua usage parameter: monies = player.wealth() Lua usage parameter: monies, readable = player.wealth( 2 )

Lua function parameter:[opt] number decimal Optional argument that makes it return human readable form with so many decimals. Lua return parameter: number The player's wealth in numerical form. Lua return parameter: string The player's wealth in human-readable form.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: wealth

Definition at line 402 of file nlua_player.c.

Variable Documentation

◆ playerL_methods

const luaL_Reg playerL_methods[]
static

Player Lua methods.

Definition at line 170 of file nlua_player.c.