naev 0.10.4
Functions | Variables
nlua_pilotoutfit.c File Reference

Handles the Lua pilot outfit (equipped) bindings. More...

#include "nlua_pilotoutfit.h"
#include "log.h"
#include "nlua_outfit.h"
#include "nluadef.h"
#include "rng.h"
#include "slots.h"

Go to the source code of this file.

Functions

static int poL_outfit (lua_State *L)
 Gets the outfit of the PilotOutfit. More...
 
static int poL_state (lua_State *L)
 Sets the state of the PilotOutfit. More...
 
static int poL_progress (lua_State *L)
 Sets the state progress of the PilotOutfit. More...
 
static int poL_set (lua_State *L)
 Sets a temporary ship stat modifier of the pilot outfit. More...
 
static int poL_clear (lua_State *L)
 Clears all the temporary ship stat modifiers of the pilot outfit. More...
 
int nlua_loadPilotOutfit (nlua_env env)
 Loads the pilot outfit library. More...
 
PilotOutfitSlotlua_topilotoutfit (lua_State *L, int ind)
 Lua bindings to interact with pilot outfits. More...
 
PilotOutfitSlotluaL_checkpilotoutfit (lua_State *L, int ind)
 Gets outfit at index or raises error if there is no outfit at index. More...
 
PilotOutfitSlotluaL_validpilotoutfit (lua_State *L, int ind)
 Makes sure the outfit is valid or raises a Lua error. More...
 
PilotOutfitSlot ** lua_pushpilotoutfit (lua_State *L, PilotOutfitSlot *po)
 Pushes a pilot outfit on the stack. More...
 
int lua_ispilotoutfit (lua_State *L, int ind)
 Checks to see if ind is a pilot outfit. More...
 

Variables

int pilotoutfit_modified = 0
 
static const luaL_Reg poL_methods []
 

Detailed Description

Handles the Lua pilot outfit (equipped) bindings.

Definition in file nlua_pilotoutfit.c.

Function Documentation

◆ lua_ispilotoutfit()

int lua_ispilotoutfit ( lua_State *  L,
int  ind 
)

Checks to see if ind is a pilot outfit.

Parameters
LLua state to check.
indIndex position to check.
Returns
1 if ind is a pilot outfit.

Definition at line 127 of file nlua_pilotoutfit.c.

◆ lua_pushpilotoutfit()

PilotOutfitSlot ** lua_pushpilotoutfit ( lua_State *  L,
PilotOutfitSlot po 
)

Pushes a pilot outfit on the stack.

Parameters
LLua state to push outfit into.
poPilot outfit to push.
Returns
Newly pushed pilotoutfit.

Definition at line 112 of file nlua_pilotoutfit.c.

◆ lua_topilotoutfit()

PilotOutfitSlot * lua_topilotoutfit ( lua_State *  L,
int  ind 
)

Lua bindings to interact with pilot outfits.

Lua module: pilotoutfit

Gets outfit at index.

Parameters
LLua state to get outfit from.
indIndex position to find the outfit.
Returns
Outfit found at the index in the state.

Definition at line 64 of file nlua_pilotoutfit.c.

◆ luaL_checkpilotoutfit()

PilotOutfitSlot * luaL_checkpilotoutfit ( lua_State *  L,
int  ind 
)

Gets outfit at index or raises error if there is no outfit at index.

Parameters
LLua state to get outfit from.
indIndex position to find outfit.
Returns
Outfit found at the index in the state.

Definition at line 75 of file nlua_pilotoutfit.c.

◆ luaL_validpilotoutfit()

PilotOutfitSlot * luaL_validpilotoutfit ( lua_State *  L,
int  ind 
)

Makes sure the outfit is valid or raises a Lua error.

Parameters
LState currently running.
indIndex of the outfit to validate.
Returns
The outfit (doesn't return if fails - raises Lua error ).

Definition at line 89 of file nlua_pilotoutfit.c.

◆ nlua_loadPilotOutfit()

int nlua_loadPilotOutfit ( nlua_env  env)

Loads the pilot outfit library.

Parameters
envEnvironment to load pilot outfit library into.
Returns
0 on success.

Definition at line 46 of file nlua_pilotoutfit.c.

◆ poL_clear()

static int poL_clear ( lua_State *  L)
static

Clears all the temporary ship stat modifiers of the pilot outfit.

Lua function parameter: PilotOutfit po Pilot outfit to clear temporary modifiers from.

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

Lua function: clear

Definition at line 233 of file nlua_pilotoutfit.c.

◆ poL_outfit()

static int poL_outfit ( lua_State *  L)
static

Gets the outfit of the PilotOutfit.

Lua function parameter: PilotOutfit po Pilot outfit to get the outfit of. Lua function parameter: Outfit Outfit corresponding to the Pilot outfit.

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

Lua function: outfit

Definition at line 150 of file nlua_pilotoutfit.c.

◆ poL_progress()

static int poL_progress ( lua_State *  L)
static

Sets the state progress of the PilotOutfit.

Lua function parameter: PilotOutfit po Pilot outfit to set the state of. Lua function parameter: number progress Progress of the current state with 1 being started and 0 being done.

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

Lua function: progress

Definition at line 198 of file nlua_pilotoutfit.c.

◆ poL_set()

static int poL_set ( lua_State *  L)
static

Sets a temporary ship stat modifier of the pilot outfit.

Lua function parameter: PilotOutfit po Pilot outfit to set the modifier of. Lua function parameter: string mod Modifier name to set to. Same as in the XML definition. Lua function parameter: number val Value to set the modifier to. In the case of booleans, 0 indicates false, while 1 indicates true.

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

Lua function: set

Definition at line 217 of file nlua_pilotoutfit.c.

◆ poL_state()

static int poL_state ( lua_State *  L)
static

Sets the state of the PilotOutfit.

Lua function parameter: PilotOutfit po Pilot outfit to set the state of. Lua function parameter: string state State to set the pilot outfit to. Can be either "off", "warmup", "on", or "cooldown".

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

Lua function: state

Definition at line 164 of file nlua_pilotoutfit.c.

Variable Documentation

◆ pilotoutfit_modified

int pilotoutfit_modified = 0

Definition at line 23 of file nlua_pilotoutfit.c.

◆ poL_methods

const luaL_Reg poL_methods[]
static
Initial value:
= {
{ "outfit", poL_outfit },
{ "state", poL_state },
{ "progress", poL_progress },
{ "set", poL_set },
{ "clear", poL_clear },
{0,0}
}
static int poL_progress(lua_State *L)
Sets the state progress of the PilotOutfit.
static int poL_set(lua_State *L)
Sets a temporary ship stat modifier of the pilot outfit.
static int poL_outfit(lua_State *L)
Gets the outfit of the PilotOutfit.
static int poL_state(lua_State *L)
Sets the state of the PilotOutfit.
static int poL_clear(lua_State *L)
Clears all the temporary ship stat modifiers of the pilot outfit.

Pilot outfit metatable methods.

Definition at line 31 of file nlua_pilotoutfit.c.