naev 0.12.5
nlua_faction.c File Reference

Handles the Lua faction bindings. More...

#include "nlua_faction.h"
#include "array.h"
#include "faction.h"
#include "nlua.h"
#include "nlua_colour.h"
#include "nlua_system.h"
#include "nlua_tex.h"
#include "nluadef.h"
Include dependency graph for nlua_faction.c:

Go to the source code of this file.

Functions

static LuaFaction luaL_validfactionSilent (lua_State *L, int ind)
static int factionL_exists (lua_State *L)
 Lua bindings to deal with factions.
static int factionL_get (lua_State *L)
 Gets the faction based on its name.
static int factionL_getAll (lua_State *L)
 Gets all the factions.
static int factionL_player (lua_State *L)
 Gets the player's faction.
static int factionL_eq (lua_State *L)
 __eq (equality) metamethod for factions.
static int factionL_name (lua_State *L)
 Gets the faction's translated short name.
static int factionL_nameRaw (lua_State *L)
 Gets the faction's raw / "real" (untranslated, internal) name.
static int factionL_longname (lua_State *L)
 Gets the faction's translated long name.
static int factionL_areneutral (lua_State *L)
 Checks to see if two factions are truly neutral with respect to each other.
static int factionL_areenemies (lua_State *L)
 Checks to see if f is an enemy of e.
static int factionL_areallies (lua_State *L)
 Checks to see if f is an ally of a.
static int factionL_usesHiddenJumps (lua_State *L)
 Gets whether or not a faction uses hidden jumps.
static int factionL_hit (lua_State *L)
 Modifies the player's standing with the faction.
static int factionL_hitTest (lua_State *L)
 Simulates modifying the player's standing with a faction and computes how much would be changed.
static int factionL_reputationGlobal (lua_State *L)
 Gets the player's global reputation with the faction.
static int factionL_reputationText (lua_State *L)
 Gets the human readable standing text correpsonding (translated).
static int factionL_reputationDefault (lua_State *L)
 Gets the player's default reputation with the faction.
static int factionL_setReputationGlobal (lua_State *L)
 Overrides the player's faction global standing with a faction. Use sparingly as it overrites local standings at all systems.
static int factionL_applyLocalThreshold (lua_State *L)
 Enforces the local threshold of a faction starting at a particular system. Meant to be used when computing faction hits from the faction standing Lua scripts. Not meant for use elsewhere.
static int factionL_enemies (lua_State *L)
 Gets the enemies of the faction.
static int factionL_allies (lua_State *L)
 Gets the allies of the faction.
static int factionL_logo (lua_State *L)
 Gets the faction logo.
static int factionL_colour (lua_State *L)
 Gets the faction colour.
static int factionL_isKnown (lua_State *L)
 Checks to see if a faction is known by the player.
static int factionL_setKnown (lua_State *L)
 Sets a faction's known state.
static int factionL_isInvisible (lua_State *L)
 Checks to see if a faction is invisible the player.
static int factionL_isStatic (lua_State *L)
 Checks to see if a faction has a static standing with the player.
static int factionL_reputationOverride (lua_State *L)
 Gets the overriden reputation value of a faction.
static int factionL_setReputationOverride (lua_State *L)
 Gets the overriden reputation value of a faction.
static int factionL_tags (lua_State *L)
 Gets the tags a faction has.
static int factionL_dynAdd (lua_State *L)
 Adds a faction dynamically. Note that if the faction already exists as a dynamic faction, the existing one is returned.
static int factionL_dynAlly (lua_State *L)
 Adds or removes allies to a faction. Only works with dynamic factions.
static int factionL_dynEnemy (lua_State *L)
 Adds or removes enemies to a faction. Only works with dynamic factions.
static int factionL_modplayer (lua_State *L)
 Modifies the player's standing with the faction.
static int factionL_modplayersingle (lua_State *L)
 Modifies the player's standing with the faction.
static int factionL_modplayerraw (lua_State *L)
 Modifies the player's standing with the faction.
static int factionL_setplayerstanding (lua_State *L)
 Sets the player's standing with the faction.
static int factionL_playerstanding (lua_State *L)
 Gets the player's standing with the faction.
static int factionL_playerstandingdefault (lua_State *L)
 Gets the player's default standing with the faction.
int nlua_loadFaction (nlua_env env)
 Loads the faction library.
LuaFaction lua_tofaction (lua_State *L, int ind)
 Gets faction at index.
LuaFaction lua_checkfaction (lua_State *L, int ind)
LuaFaction luaL_validfaction (lua_State *L, int ind)
 Gets faction (or faction name) at index, raising an error if type isn't a valid faction.
LuaFaction * lua_pushfaction (lua_State *L, LuaFaction faction)
 Pushes a faction on the stack.
int lua_isfaction (lua_State *L, int ind)
 Checks to see if ind is a faction.

Variables

static const luaL_Reg faction_methods []

Detailed Description

Handles the Lua faction bindings.

These bindings control the factions.

Definition in file nlua_faction.c.

Function Documentation

◆ factionL_allies()

int factionL_allies ( lua_State * L)
static

Gets the allies of the faction.

Lua usage parameter: for k,v in pairs(f:allies()) do – Iterate over faction allies

Lua function parameter: Faction f Faction to get allies of. Lua return parameter: {Faction,...} A table containing the allies of the faction.

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

Lua function: allies

Definition at line 749 of file nlua_faction.c.

◆ factionL_applyLocalThreshold()

int factionL_applyLocalThreshold ( lua_State * L)
static

Enforces the local threshold of a faction starting at a particular system. Meant to be used when computing faction hits from the faction standing Lua scripts. Not meant for use elsewhere.

Lua function parameter: Faction f Faction to apply local thresholding to. Lua function parameter: System sys System to compute the thresholding from. This will be the reference and will not have its value modified.

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

Lua function: applyLocalThreshold

Definition at line 575 of file nlua_faction.c.

◆ factionL_areallies()

int factionL_areallies ( lua_State * L)
static

Checks to see if f is an ally of a.

Lua usage parameter: if f:areAllies( faction.get( "Pirate" ) ) then

Lua function parameter: Faction f Faction to check against. Lua function parameter: faction a Faction to check if is an enemy. Lua function parameter:[opt] System sys System to check to see if they are allies in. Mainly for when comparing to the player's faction. Lua return parameter: boolean true if they are enemies, false if they aren't.

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

Lua function: areAllies

Definition at line 424 of file nlua_faction.c.

◆ factionL_areenemies()

int factionL_areenemies ( lua_State * L)
static

Checks to see if f is an enemy of e.

Lua usage parameter: if f:areEnemies( faction.get( "Dvaered" ) ) then

Lua function parameter: Faction f Faction to check against. Lua function parameter: Faction e Faction to check if is an enemy. Lua function parameter:[opt] System sys System to check to see if they are enemies in. Mainly for when comparing to the player's faction. Lua return parameter: boolean true if they are enemies, false if they aren't.

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

Lua function: areEnemies

Definition at line 401 of file nlua_faction.c.

◆ factionL_areneutral()

int factionL_areneutral ( lua_State * L)
static

Checks to see if two factions are truly neutral with respect to each other.

Lua function parameter: Faction f Faction to check against. Lua function parameter: Faction n Faction to check if is true neutral. Lua return parameter: boolean true if they are truely neutral, false if they aren't.

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

Lua function: areNeutral

Definition at line 381 of file nlua_faction.c.

◆ factionL_colour()

int factionL_colour ( lua_State * L)
static

Gets the faction colour.

Lua function parameter: Faction f Faction to get colour from. Lua return parameter: Colour|nil The faction colour or nil if not applicable.

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

Lua function: colour

Definition at line 804 of file nlua_faction.c.

◆ factionL_dynAdd()

int factionL_dynAdd ( lua_State * L)
static

Adds a faction dynamically. Note that if the faction already exists as a dynamic faction, the existing one is returned.

Note
Defaults to known.

Lua function parameter: Faction|nil base Faction to base it off of or nil for new faction. Lua function parameter: string name Name to give the faction. Lua function parameter:[opt] string display Display name to give the faction. Lua function parameter:[opt] table params Table of parameters. Options include "ai" (string) to set the AI to use, "clear_allies" (boolean) to clear all allies, "clear_enemies" (boolean) to clear all enemies, "player" (number) to set the default player standing, "colour" (string|colour) which represents the factional colours.

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

Lua function: dynAdd

Definition at line 951 of file nlua_faction.c.

◆ factionL_dynAlly()

int factionL_dynAlly ( lua_State * L)
static

Adds or removes allies to a faction. Only works with dynamic factions.

Lua function parameter: Faction fac Faction to add ally to. Lua function parameter: Faction ally Faction to add as an ally. Lua function parameter:[opt=false] boolean remove Whether or not to remove the ally from the faction instead of adding it.

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

Lua function: dynAlly

Definition at line 1040 of file nlua_faction.c.

◆ factionL_dynEnemy()

int factionL_dynEnemy ( lua_State * L)
static

Adds or removes enemies to a faction. Only works with dynamic factions.

Lua function parameter: Faction fac Faction to add enemy to. Lua function parameter: Faction enemy Faction to add as an enemy. Lua function parameter:[opt=false] boolean remove Whether or not to remove the enemy from the faction instead of adding it.

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

Lua function: dynEnemy

Definition at line 1066 of file nlua_faction.c.

◆ factionL_enemies()

int factionL_enemies ( lua_State * L)
static

Gets the enemies of the faction.

Lua usage parameter: for k,v in pairs(f:enemies()) do – Iterates over enemies

Lua function parameter: Faction f Faction to get enemies of. Lua return parameter: {Faction,...} A table containing the enemies of the faction.

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

Lua function: enemies

Definition at line 724 of file nlua_faction.c.

◆ factionL_eq()

int factionL_eq ( lua_State * L)
static

__eq (equality) metamethod for factions.

You can use the '==' operator within Lua to compare factions with this.

Lua usage parameter: if f == faction.get( "Dvaered" ) then

Lua function parameter: Faction f Faction comparing. Lua function parameter: Faction comp faction to compare against. Lua return parameter: boolean true if both factions are the same.

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

Lua function: __eq

Definition at line 302 of file nlua_faction.c.

◆ factionL_exists()

int factionL_exists ( lua_State * L)
static

Lua bindings to deal with factions.

Use like:

f = faction.get( "Empire" )
if f:playerStanding() < 0 then
-- player is hostile to "Empire"
end
Player_t player
Definition player.c:77

Lua module: faction

Gets a faction if it exists.

Lua usage parameter: f = faction.exists( "Empire" )

Lua function parameter: string name Name of the faction to get if exists. Lua return parameter: Faction The faction matching name or nil if not matched.

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

Lua function: exists

Definition at line 147 of file nlua_faction.c.

◆ factionL_get()

int factionL_get ( lua_State * L)
static

Gets the faction based on its name.

Lua usage parameter: f = faction.get( "Empire" )

Lua function parameter: string name Name of the faction to get. Lua return parameter: Faction The faction matching name.

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

Lua function: get

Definition at line 166 of file nlua_faction.c.

◆ factionL_getAll()

int factionL_getAll ( lua_State * L)
static

Gets all the factions.

Lua return parameter: {Faction,...} An ordered table containing all of the factions.

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

Lua function: getAll

Definition at line 179 of file nlua_faction.c.

◆ factionL_hit()

int factionL_hit ( lua_State * L)
static

Modifies the player's standing with the faction.

Also can modify the standing with allies and enemies of the faction.

Lua usage parameter: f:hit( -5, system.cur() ) – Lowers faction by 5 at the current system Lua usage parameter: f:hit( 10 ) – Globally increases faction by 10 Lua usage parameter: f:hit( 10, nil, nil, true ) – Globally increases faction by 10, but doesn't affect allies nor enemies of the faction.

Lua function parameter: Faction f Faction to modify player's standing with. Lua function parameter: number mod Amount of reputation to change. Lua function parameter: System|nil Whether to make the faction hit local at a system, or global affecting all systems of the faction. Lua function parameter:[opt="script"] string reason Reason behind it. This is passed as a string to the faction "hit" function. The engine can generate "kill" and "distress" sources. For missions the default is "script". Lua function parameter:[opt=false] boolean single Whether or not the hit should affect allies/enemies of the faction getting a hit. Lua return parameter: How much the reputation was actually changed after Lua script was run.

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

Lua function: hit

Definition at line 458 of file nlua_faction.c.

◆ factionL_hitTest()

int factionL_hitTest ( lua_State * L)
static

Simulates modifying the player's standing with a faction and computes how much would be changed.

Lua function parameter: Faction f Faction to simulate player's standing with. Lua function parameter: number mod Amount of reputation to simulate change. Lua function parameter: System|nil Whether to make the faction hit local at a system, or global. Lua function parameter:[opt="script"] string reason Reason behind it. This is passed as a string to the faction "hit" function. The engine can generate "kill" and "distress" sources. For missions the default is "script". Lua return parameter: How much the reputation was actually changed after Lua script was run.

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

Lua function: hit

Definition at line 485 of file nlua_faction.c.

◆ factionL_isInvisible()

int factionL_isInvisible ( lua_State * L)
static

Checks to see if a faction is invisible the player.

Lua usage parameter: b = f:invisible()

Lua function parameter: Faction f Faction to check if is invisible to the player. Lua return parameter: boolean true if the faction is invisible to the player.

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

Lua function: invisible

Definition at line 855 of file nlua_faction.c.

◆ factionL_isKnown()

int factionL_isKnown ( lua_State * L)
static

Checks to see if a faction is known by the player.

Lua usage parameter: b = f:known()

Lua function parameter: Faction f Faction to check if the player knows. Lua return parameter: boolean true if the player knows the faction.

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

Lua function: known

Definition at line 823 of file nlua_faction.c.

◆ factionL_isStatic()

int factionL_isStatic ( lua_State * L)
static

Checks to see if a faction has a static standing with the player.

Lua usage parameter: b = f:static()

Lua function parameter: Faction f Faction to check if has a static standing to the player. Lua return parameter: boolean true if the faction is static to the player.

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

Lua function: static

Definition at line 872 of file nlua_faction.c.

◆ factionL_logo()

int factionL_logo ( lua_State * L)
static

Gets the faction logo.

Lua function parameter: Faction f Faction to get logo from. Lua return parameter: Tex The faction logo or nil if not applicable.

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

Lua function: logo

Definition at line 787 of file nlua_faction.c.

◆ factionL_longname()

int factionL_longname ( lua_State * L)
static

Gets the faction's translated long name.

This translated name should be used for display purposes (e.g. messages) where the longer version of the faction's display name should be used. It cannot be used as an identifier for the faction; for that, use faction.nameRaw() instead.

Lua usage parameter: longname = f:longname() Lua function parameter: Faction f Faction to get long name of. Lua return parameter: string The long name of the faction (translated).

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

Lua function: longname

Definition at line 365 of file nlua_faction.c.

◆ factionL_modplayer()

int factionL_modplayer ( lua_State * L)
static

Modifies the player's standing with the faction.

Also modifies standing with allies and enemies of the faction.

Lua usage parameter: f:modPlayer( -5 ) – Lowers faction by 5

Lua function parameter: Faction f Faction to modify player's standing with. Lua function parameter: number mod The modifier to modify faction by. Lua function parameter:[opt="script"] string reason Reason behind it. This is passed as a string to the faction "hit" function. The engine can generate "kill" and "distress" sources. For missions the default is "script".

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

Lua function: modPlayer

Definition at line 597 of file nlua_faction.c.

◆ factionL_modplayerraw()

int factionL_modplayerraw ( lua_State * L)
static

Modifies the player's standing with the faction.

Does not affect other faction standings and is not processed by the faction Lua script, so it indicates exactly the amount to be changed.

Lua usage parameter: f:modPlayerRaw( 10 )

Lua function parameter: Faction f Faction to modify player's standing with. Lua function parameter: number mod The modifier to modify faction by.

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

Lua function: modPlayerRaw

Definition at line 643 of file nlua_faction.c.

◆ factionL_modplayersingle()

int factionL_modplayersingle ( lua_State * L)
static

Modifies the player's standing with the faction.

Does not affect other faction standings.

Lua usage parameter: f:modPlayerSingle( 10 )

Lua function parameter: Faction f Faction to modify player's standing with. Lua function parameter: number mod The modifier to modify faction by. Lua function parameter:[opt="script"] string reason Reason behind it. This is passed as a string to the faction "hit" function. The engine can generate "kill" and "distress" sources. For missions the default is "script".

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

Lua function: modPlayerSingle

Definition at line 621 of file nlua_faction.c.

◆ factionL_name()

int factionL_name ( lua_State * L)
static

Gets the faction's translated short name.

This translated name should be used for display purposes (e.g. messages) where the shorter version of the faction's display name should be used. It cannot be used as an identifier for the faction; for that, use faction.nameRaw() instead.

Lua usage parameter: shortname = f:name()

Lua function parameter: Faction f The faction to get the name of. Lua return parameter: string The name of the faction.

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

Lua function: name

Definition at line 324 of file nlua_faction.c.

◆ factionL_nameRaw()

int factionL_nameRaw ( lua_State * L)
static

Gets the faction's raw / "real" (untranslated, internal) name.

This untranslated name should be used for identification purposes (e.g. can be passed to faction.get()). It should not be used for display purposes; for that, use faction.name() or faction.longname() instead.

Lua usage parameter: name = f:nameRaw()

Lua function parameter: Faction f The faction to get the name of. Lua return parameter: string The name of the faction.

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

Lua function: nameRaw

Definition at line 345 of file nlua_faction.c.

◆ factionL_player()

int factionL_player ( lua_State * L)
static

Gets the player's faction.

Lua usage parameter: pf = faction.player()

Lua return parameter: Faction The player's faction.

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

Lua function: player

Definition at line 199 of file nlua_faction.c.

◆ factionL_playerstanding()

int factionL_playerstanding ( lua_State * L)
static

Gets the player's standing with the faction.

Lua usage parameter: if f:playerStanding() > 70 then – Player is an ally Lua usage parameter: _v, str = f:playerStanding(50) – Get the standing text for a value of 50

Lua function parameter: Faction f Faction to get player's standing with. Lua function parameter: number value Faction standing value to get string of. Lua return parameter: number The value of the standing and the human readable string. Lua return parameter: string The text corresponding to the standing (translated).

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

Lua function: playerStanding

Definition at line 685 of file nlua_faction.c.

◆ factionL_playerstandingdefault()

int factionL_playerstandingdefault ( lua_State * L)
static

Gets the player's default standing with the faction.

Lua function parameter: Faction f Faction to get player's default standing with. Lua return parameter: number The value of the standing.

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

Lua function: playerStandingDefault

Definition at line 706 of file nlua_faction.c.

◆ factionL_reputationDefault()

int factionL_reputationDefault ( lua_State * L)
static

Gets the player's default reputation with the faction.

Lua function parameter: Faction f Faction to get player's default standing with. Lua return parameter: number The value of the standing.

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

Lua function: reputationDefault

Definition at line 541 of file nlua_faction.c.

◆ factionL_reputationGlobal()

int factionL_reputationGlobal ( lua_State * L)
static

Gets the player's global reputation with the faction.

Lua usage parameter: if f:reputationGlobal() >= 0 then – Player is not hostile

Lua function parameter: Faction f Faction to get player's standing with. Lua return parameter: number The value of the standing.

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

Lua function: reputationGlobal

Definition at line 506 of file nlua_faction.c.

◆ factionL_reputationOverride()

int factionL_reputationOverride ( lua_State * L)
static

Gets the overriden reputation value of a faction.

Lua function parameter: Faction f Faction to get whether or not the reputation is overriden and the value. Lua return parameter: number|nil The override reputation value or nil if not overriden.

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

Lua function: reputationOverride

Definition at line 888 of file nlua_faction.c.

◆ factionL_reputationText()

int factionL_reputationText ( lua_State * L)
static

Gets the human readable standing text correpsonding (translated).

Lua function parameter: faction f Faction to get standing text from. Lua function parameter:[opt=f:reputationGlobal()] number|nil val Value to get the standing text of, or nil to use the global faction standing. Lua return parameter: string Translated text corresponding to the faction value.

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

Lua function: reputationText

Definition at line 522 of file nlua_faction.c.

◆ factionL_setKnown()

int factionL_setKnown ( lua_State * L)
static

Sets a faction's known state.

Lua usage parameter: f:setKnown( false ) – Makes faction unknown. Lua function parameter: Faction f Faction to set known. Lua function parameter:[opt=false] boolean b Whether or not to set as known.

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

Lua function: setKnown

Definition at line 838 of file nlua_faction.c.

◆ factionL_setplayerstanding()

int factionL_setplayerstanding ( lua_State * L)
static

Sets the player's standing with the faction.

Lua usage parameter: f:setPlayerStanding(70) – Make player an ally

Lua function parameter: Faction f Faction to set the player's standing for. Lua function parameter: number value Value to set the player's standing to (from -100 to 100).

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

Lua function: setPlayerStanding

Definition at line 662 of file nlua_faction.c.

◆ factionL_setReputationGlobal()

int factionL_setReputationGlobal ( lua_State * L)
static

Overrides the player's faction global standing with a faction. Use sparingly as it overrites local standings at all systems.

Lua function parameter: Faction f Faction to set the player's global reputation with. Lua function parameter: number The value of the reputation to set to.

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

Lua function: setReputationGlobal

Definition at line 556 of file nlua_faction.c.

◆ factionL_setReputationOverride()

int factionL_setReputationOverride ( lua_State * L)
static

Gets the overriden reputation value of a faction.

Lua function parameter: Faction f Faction to enable/disable reputation override of. Lua function parameter: number|nil Sets the faction reputation override to the value if a number, or disables it if nil.

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

Lua function: setReputationOverride

Definition at line 907 of file nlua_faction.c.

◆ factionL_tags()

int factionL_tags ( lua_State * L)
static

Gets the tags a faction has.

Lua usage parameter: for k,v in ipairs(f:tags()) do ... end Lua usage parameter: if f:tags().likes_cheese then ... end Lua usage parameter: if f:tags("generic") then ... end

Lua function parameter:[opt=nil] string tag Tag to check if exists. Lua return parameter: table|boolean Table of tags where the name is the key and true is the value or a boolean value if a string is passed as the second parameter indicating whether or not the specified tag exists.

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

Lua function: tags

Definition at line 928 of file nlua_faction.c.

◆ factionL_usesHiddenJumps()

int factionL_usesHiddenJumps ( lua_State * L)
static

Gets whether or not a faction uses hidden jumps.

Lua function parameter: Faction f Faction to get whether or not they use hidden jumps. Lua return parameter: boolean true if the faction uses hidden jumps, false otherwise.

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

Lua function: usesHiddenJumps

Definition at line 773 of file nlua_faction.c.

◆ lua_checkfaction()

LuaFaction lua_checkfaction ( lua_State * L,
int ind )

Definition at line 217 of file nlua_faction.c.

◆ lua_isfaction()

int lua_isfaction ( lua_State * L,
int ind )

Checks to see if ind is a faction.

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

Definition at line 274 of file nlua_faction.c.

◆ lua_pushfaction()

LuaFaction * lua_pushfaction ( lua_State * L,
LuaFaction faction )

Pushes a faction on the stack.

Parameters
LLua state to push faction into.
factionFaction to push.
Returns
Newly pushed faction.

Definition at line 259 of file nlua_faction.c.

◆ lua_tofaction()

LuaFaction lua_tofaction ( lua_State * L,
int ind )

Gets faction at index.

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

Definition at line 212 of file nlua_faction.c.

◆ luaL_validfaction()

LuaFaction luaL_validfaction ( lua_State * L,
int ind )

Gets faction (or faction name) at index, raising an error if type isn't a valid faction.

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

Definition at line 243 of file nlua_faction.c.

◆ luaL_validfactionSilent()

LuaFaction luaL_validfactionSilent ( lua_State * L,
int ind )
static

Definition at line 225 of file nlua_faction.c.

◆ nlua_loadFaction()

int nlua_loadFaction ( nlua_env env)

Loads the faction library.

Parameters
envEnvironment to load faction library into.
Returns
0 on success.

Definition at line 119 of file nlua_faction.c.

Variable Documentation

◆ faction_methods

const luaL_Reg faction_methods[]
static

Faction metatable methods.

Definition at line 70 of file nlua_faction.c.