naev 0.10.4
Functions | Variables
nlua_jump.c File Reference

Lua jump module. More...

#include "nlua_jump.h"
#include "nluadef.h"
#include "nlua_vec2.h"
#include "nlua_system.h"
#include "land_outfits.h"
#include "map_overlay.h"
#include "log.h"

Go to the source code of this file.

Functions

static RETURNS_NONNULL JumpPoint * luaL_validjumpSystem (lua_State *L, int ind, int *offset)
 Back-end for luaL_validjump. More...
 
static int jumpL_get (lua_State *L)
 Gets a jump. More...
 
static int jumpL_eq (lua_State *L)
 You can use the '==' operator within Lua to compare jumps with this. More...
 
static int jumpL_tostring (lua_State *L)
 Converts a jump to readable form. Mainly meant to be used for printing. More...
 
static int jumpL_radius (lua_State *L)
 Gets the jump's radius. More...
 
static int jumpL_position (lua_State *L)
 Gets the position of the jump in the system. More...
 
static int jumpL_angle (lua_State *L)
 Gets the angle of a jump in radians. More...
 
static int jumpL_hidden (lua_State *L)
 Checks whether a jump is hidden. More...
 
static int jumpL_exitonly (lua_State *L)
 Checks whether a jump is exit-only. More...
 
static int jumpL_system (lua_State *L)
 Gets the system that a jump point exists in. More...
 
static int jumpL_dest (lua_State *L)
 Gets the system that a jump point exits into. More...
 
static int jumpL_isKnown (lua_State *L)
 Checks to see if a jump is known by the player. More...
 
static int jumpL_setKnown (lua_State *L)
 Sets a jump's known state. More...
 
int nlua_loadJump (nlua_env env)
 Loads the jump library. More...
 
LuaJumplua_tojump (lua_State *L, int ind)
 This module allows you to handle the jumps from Lua. More...
 
LuaJumpluaL_checkjump (lua_State *L, int ind)
 Gets jump at index raising an error if isn't a jump. More...
 
JumpPoint * luaL_validjump (lua_State *L, int ind)
 Gets a jump directly. More...
 
LuaJumplua_pushjump (lua_State *L, LuaJump jump)
 Pushes a jump on the stack. More...
 
int lua_isjump (lua_State *L, int ind)
 Checks to see if ind is a jump. More...
 

Variables

static const luaL_Reg jump_methods []
 

Detailed Description

Lua jump module.

Definition in file nlua_jump.c.

Function Documentation

◆ jumpL_angle()

static int jumpL_angle ( lua_State *  L)
static

Gets the angle of a jump in radians.

Lua usage parameter: v = j:angle() Lua function parameter: Jump j Jump to get the angle of. Lua return parameter: number The angle.

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

Lua function: angle

Definition at line 329 of file nlua_jump.c.

◆ jumpL_dest()

static int jumpL_dest ( lua_State *  L)
static

Gets the system that a jump point exits into.

Lua usage parameter: v = j:dest() Lua function parameter: Jump j Jump to get the destination of. Lua return parameter: System The jump's destination system.

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

Lua function: dest

Definition at line 389 of file nlua_jump.c.

◆ jumpL_eq()

static int jumpL_eq ( lua_State *  L)
static

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

Lua usage parameter: if j:__eq( jump.get( "Rhu", "Ruttwi" ) ) then – Do something Lua function parameter: Jump j Jump comparing. Lua function parameter: Jump comp jump to compare against. Lua return parameter: boolean true if both jumps are the same.

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

Lua function: __eq

Definition at line 265 of file nlua_jump.c.

◆ jumpL_exitonly()

static int jumpL_exitonly ( lua_State *  L)
static

Checks whether a jump is exit-only.

Lua usage parameter: if jump.exitonly("Eneguoz", "Zied") then – The jump point in Eneguoz cannot be entered. Lua function parameter: Jump j Jump to get the exit-only status of. Lua return parameter: boolean Whether the jump is exit-only.

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

Lua function: exitonly

Definition at line 359 of file nlua_jump.c.

◆ jumpL_get()

static int jumpL_get ( lua_State *  L)
static

Gets a jump.

Possible values of params:

  • string : Gets the jump by system name.
  • system : Gets the jump by system.

Lua usage parameter: j,r = jump.get( "Ogat", "Goddard" ) – Returns the Ogat to Goddard and Goddard to Ogat jumps. Lua function parameter: string|System src See description. Lua function parameter: string|System dest See description. Lua return parameter: Jump Returns the jump. Lua return parameter: Jump Returns the inverse.

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

Lua function: get

Definition at line 228 of file nlua_jump.c.

◆ jumpL_hidden()

static int jumpL_hidden ( lua_State *  L)
static

Checks whether a jump is hidden.

Lua usage parameter: if not j:hidden() then – Exclude hidden jumps. Lua function parameter: Jump j Jump to get the hidden status of. Lua return parameter: boolean Whether the jump is hidden.

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

Lua function: hidden

Definition at line 344 of file nlua_jump.c.

◆ jumpL_isKnown()

static int jumpL_isKnown ( lua_State *  L)
static

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

Lua usage parameter: b = j:known()

Lua function parameter: Jump j Jump to check if the player knows. Lua return parameter: boolean true if the player knows the jump.

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

Lua function: known

Definition at line 405 of file nlua_jump.c.

◆ jumpL_position()

static int jumpL_position ( lua_State *  L)
static

Gets the position of the jump in the system.

Lua usage parameter: v = j:pos() Lua function parameter: Jump j Jump to get the position of. Lua return parameter: Vec2 The position of the jump in the system.

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

Lua function: pos

Definition at line 314 of file nlua_jump.c.

◆ jumpL_radius()

static int jumpL_radius ( lua_State *  L)
static

Gets the jump's radius.

Lua usage parameter: radius = j:radius() Lua function parameter: Jump j Jump to get the radius of. Lua return parameter: number The jump's radius.

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

Lua function: radius

Definition at line 299 of file nlua_jump.c.

◆ jumpL_setKnown()

static int jumpL_setKnown ( lua_State *  L)
static

Sets a jump's known state.

Lua usage parameter: j:setKnown( false ) – Makes jump unknown. Lua function parameter: Jump j Jump to set known. Lua function parameter:[opt=true] boolean value 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 420 of file nlua_jump.c.

◆ jumpL_system()

static int jumpL_system ( lua_State *  L)
static

Gets the system that a jump point exists in.

Lua usage parameter: s = j:system() Lua function parameter: Jump j Jump to get the system of. Lua return parameter: System The jump's system.

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

Lua function: system

Definition at line 374 of file nlua_jump.c.

◆ jumpL_tostring()

static int jumpL_tostring ( lua_State *  L)
static

Converts a jump to readable form. Mainly meant to be used for printing.

Lua function parameter: Jump j Jump to print.

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

Lua function: __tostring

Definition at line 280 of file nlua_jump.c.

◆ lua_isjump()

int lua_isjump ( lua_State *  L,
int  ind 
)

Checks to see if ind is a jump.

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

Definition at line 198 of file nlua_jump.c.

◆ lua_pushjump()

LuaJump * lua_pushjump ( lua_State *  L,
LuaJump  jump 
)

Pushes a jump on the stack.

Parameters
LLua state to push jump into.
jumpJump to push.
Returns
Newly pushed jump.

Definition at line 182 of file nlua_jump.c.

◆ lua_tojump()

LuaJump * lua_tojump ( lua_State *  L,
int  ind 
)

This module allows you to handle the jumps from Lua.

Generally you do something like:

j = jump.get("Gamma Polaris", "Apez") -- Get the jump from Gamma Polaris to Apez
if j:known() then -- The jump is known
v = j:pos() -- Get the position
-- Do other stuff
end

Lua module: jump

Gets jump at index.

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

Definition at line 89 of file nlua_jump.c.

◆ luaL_checkjump()

LuaJump * luaL_checkjump ( lua_State *  L,
int  ind 
)

Gets jump at index raising an error if isn't a jump.

Parameters
LLua state to get jump from.
indIndex to check.
Returns
Jump found at the index in the state.

Definition at line 100 of file nlua_jump.c.

◆ luaL_validjump()

JumpPoint * luaL_validjump ( lua_State *  L,
int  ind 
)

Gets a jump directly.

Parameters
LLua state to get jump from.
indIndex to check.
Returns
Jump found at the index in the state.

Definition at line 170 of file nlua_jump.c.

◆ luaL_validjumpSystem()

static JumpPoint * luaL_validjumpSystem ( lua_State *  L,
int  ind,
int *  offset 
)
static

Back-end for luaL_validjump.

Parameters
LLua state to get jump from.
indIndex to check.
[out]offsetHow many Lua arguments were passed.
Returns
Jump found at the index in the state.
See also
luaL_validjump

Definition at line 118 of file nlua_jump.c.

◆ nlua_loadJump()

int nlua_loadJump ( nlua_env  env)

Loads the jump library.

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

Definition at line 61 of file nlua_jump.c.

Variable Documentation

◆ jump_methods

const luaL_Reg jump_methods[]
static
Initial value:
= {
{ "get", jumpL_get },
{ "__eq", jumpL_eq },
{ "__tostring", jumpL_tostring },
{ "radius", jumpL_radius },
{ "pos", jumpL_position },
{ "angle", jumpL_angle },
{ "hidden", jumpL_hidden },
{ "exitonly", jumpL_exitonly },
{ "system", jumpL_system },
{ "dest", jumpL_dest },
{ "known", jumpL_isKnown },
{ "setKnown", jumpL_setKnown },
{0,0}
}
static int jumpL_tostring(lua_State *L)
Converts a jump to readable form. Mainly meant to be used for printing.
Definition: nlua_jump.c:280
static int jumpL_exitonly(lua_State *L)
Checks whether a jump is exit-only.
Definition: nlua_jump.c:359
static int jumpL_setKnown(lua_State *L)
Sets a jump's known state.
Definition: nlua_jump.c:420
static int jumpL_system(lua_State *L)
Gets the system that a jump point exists in.
Definition: nlua_jump.c:374
static int jumpL_angle(lua_State *L)
Gets the angle of a jump in radians.
Definition: nlua_jump.c:329
static int jumpL_radius(lua_State *L)
Gets the jump's radius.
Definition: nlua_jump.c:299
static int jumpL_isKnown(lua_State *L)
Checks to see if a jump is known by the player.
Definition: nlua_jump.c:405
static int jumpL_dest(lua_State *L)
Gets the system that a jump point exits into.
Definition: nlua_jump.c:389
static int jumpL_eq(lua_State *L)
You can use the '==' operator within Lua to compare jumps with this.
Definition: nlua_jump.c:265
static int jumpL_get(lua_State *L)
Gets a jump.
Definition: nlua_jump.c:228
static int jumpL_hidden(lua_State *L)
Checks whether a jump is hidden.
Definition: nlua_jump.c:344
static int jumpL_position(lua_State *L)
Gets the position of the jump in the system.
Definition: nlua_jump.c:314

Jump metatable methods.

Definition at line 39 of file nlua_jump.c.