Naev

Module naev

Naev generic Lua bindings.

Functions

version () Gets the version of Naev and the save game.
versionTest (v1, v2) Tests two semver version strings.
language () Gets the current language locale.
lastplayed () Gets how many days it has been since the player last played Naev.
ticksGame () Gets the game seconds since the program started running.
ticks () Gets the seconds since the program started running.
clock () Gets the approximate CPU processing time.
keyGet (keyname) Gets a human-readable name for the key bound to a function.
keyEnable (keyname[, enable=false]) Disables or enables a specific keybinding.
keyEnableAll () Enables all inputs.
keyDisableAll () Disables all inputs.
eventStart (evtname) Starts an event, does not start check conditions.
missionStart (misnname) Starts a mission, does no check start conditions.
eventReload (evtname) Reloads an event's script, providing a convenient way to test and hopefully not corrupt the game's state.
missionReload (misnname) Reloads a mission's script, providing a convenient way to test and hopefully not corrupt the game's state.
isSimulation () Gets whether or not the universe is being simulated or not.
conf () Gets the configuration information.
confSet (name, value) Sets configuration variables.
cache () Gets the global Lua runtime cache.


Functions

version ()
Gets the version of Naev and the save game.

Returns:

  1. string The version of the game.
  2. string Version of current loaded save or nil if not loaded.

Usage:

    game_version, save_version = naev.version()
    
versionTest (v1, v2)
Tests two semver version strings.

Parameters:

Returns:

    number Positive if v1 is newer or negative if v2 is newer.
language ()
Gets the current language locale.

Returns:

    string Current language locale (such as "en" for English, "de" for German, or "ja" for Japanese).
lastplayed ()
Gets how many days it has been since the player last played Naev.

Returns:

    number Number of days since the player last played.
ticksGame ()
Gets the game seconds since the program started running.

These are modified by whatever speed up the player has.

Returns:

    number The seconds since the application started running.
ticks ()
Gets the seconds since the program started running.

Useful for doing timing on Lua functions.

Returns:

    number The seconds since the application started running.
clock ()
Gets the approximate CPU processing time.

Returns:

    number Seconds elapsed since start of the process.
keyGet (keyname)
Gets a human-readable name for the key bound to a function.

Parameters:

  • keyname string Name of the keybinding to get value of. Valid values are listed in src/input.c: keybind_info.

Usage:

    bindname = naev.keyGet( "accel" )
    
keyEnable (keyname[, enable=false])
Disables or enables a specific keybinding.

Use with caution, this can make the player get stuck.

Parameters:

  • keyname string Name of the key to disable (for example "accel").
  • enable boolean Whether to enable or disable. (default false)

Usage:

    naev.keyEnable( "accel", false ) -- Disables the acceleration key
    
keyEnableAll ()
Enables all inputs.

Usage:

    naev.keyEnableAll() -- Enables all inputs
    
keyDisableAll ()
Disables all inputs.

Usage:

    naev.keyDisableAll() -- Disables all inputs
    
eventStart (evtname)
Starts an event, does not start check conditions.

Parameters:

  • evtname string Name of the event to start.

Returns:

    boolean true on success.

Usage:

    naev.eventStart( "Some Event" )
    
missionStart (misnname)
Starts a mission, does no check start conditions.

Parameters:

  • misnname string Name of the mission to start.

Returns:

    boolean true on success.

Usage:

    naev.missionStart( "Some Mission" )
    
eventReload (evtname)
Reloads an event's script, providing a convenient way to test and hopefully not corrupt the game's state. Use with caution, and only during development as a way to get quicker feedback.

Parameters:

  • evtname string Name of the event to start.

Returns:

    boolean true on success.

Usage:

    naev.eventReload( "Some Event" )
    
missionReload (misnname)
Reloads a mission's script, providing a convenient way to test and hopefully not corrupt the game's state. Use with caution, and only during development as a way to get quicker feedback.

Parameters:

  • misnname string Name of the mission to start.

Returns:

    boolean true on success.

Usage:

    naev.missionReload( "Some Mission" )
    
isSimulation ()
Gets whether or not the universe is being simulated or not.

Returns:

    boolean true if the world is being simulated.
conf ()
Gets the configuration information.

Returns:

    table Table of configuration values as they appear in the configuration file.
confSet (name, value)
Sets configuration variables. Note that not all are supported.

Parameters:

  • name string Configuration variable name.
  • value number or string Value to set to.
cache ()
Gets the global Lua runtime cache. This is shared among all environments and is cleared when the game is closed.

Returns:

    table The Lua global cache.

Usage:

    c = naev.cache()
    
generated by LDoc 1.4.6 Last updated 2022-05-26 02:36:04