![]() |
naev 0.12.5
|
Contains Naev generic Lua bindings. More...
#include "nlua_naev.h"#include "array.h"#include "console.h"#include "debug.h"#include "difficulty.h"#include "event.h"#include "hook.h"#include "info.h"#include "input.h"#include "land.h"#include "menu.h"#include "nlua_misn.h"#include "nlua_system.h"#include "nluadef.h"#include "pause.h"#include "player.h"#include "plugin.h"#include "semver.h"
Go to the source code of this file.
Macros | |
| #define | setfield(L, key, value) |
| #define | setboolfield(L, key, value) |
| #define | PUSH_STRING(L, name, value) |
| #define | PUSH_DOUBLE(L, name, value) |
| #define | PUSH_INT(L, name, value) |
| #define | PUSH_BOOL(L, name, value) |
| #define | STRING(x) |
| #define | INTEGER(x) |
| #define | BOOL(x) |
Functions | |
| static int | naevL_version (lua_State *L) |
| Naev generic Lua bindings. | |
| static int | naevL_versionTest (lua_State *L) |
| Tests two semver version strings. | |
| static int | naevL_language (lua_State *L) |
| Gets the current language locale. | |
| static int | naevL_lastplayed (lua_State *L) |
| Gets how many days it has been since the player last played Naev. | |
| static int | naevL_date (lua_State *L) |
| Equivalent to os.date from standard Lua. | |
| static int | naevL_ticks (lua_State *L) |
| Gets the seconds since the program started running. | |
| static int | naevL_ticksGame (lua_State *L) |
| Gets the game seconds since the program started running. | |
| static int | naevL_clock (lua_State *L) |
| Gets the approximate CPU processing time. | |
| static int | naevL_fps (lua_State *L) |
| Gets the current game FPS as displayed to the player. | |
| static int | naevL_keyGet (lua_State *L) |
| Gets a human-readable name for the key bound to a function. | |
| static int | naevL_keyEnable (lua_State *L) |
| Disables or enables a specific keybinding. | |
| static int | naevL_keyEnableAll (lua_State *L) |
| Enables all inputs. | |
| static int | naevL_keyDisableAll (lua_State *L) |
| Disables all inputs. | |
| static int | naevL_eventStart (lua_State *L) |
| Starts an event, does not start check conditions. | |
| static int | naevL_eventReload (lua_State *L) |
| 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. | |
| static int | naevL_missionList (lua_State *L) |
| Lists all the missions in the game. | |
| static int | naevL_missionStart (lua_State *L) |
| Starts a mission, does no check start conditions. | |
| static int | naevL_missionTest (lua_State *L) |
| Tests a missions conditionals to see if it can be started by the player. | |
| static int | naevL_missionReload (lua_State *L) |
| 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. | |
| static int | naevL_shadersReload (lua_State *L) |
| Reloads all the Naev shaders excluding those created by the shader library. | |
| static int | naevL_isSimulation (lua_State *L) |
| Gets whether or not the universe is being simulated or not. | |
| static int | naevL_conf (lua_State *L) |
| Gets the configuration information. | |
| static int | naevL_confSet (lua_State *L) |
| Sets configuration variables. Note that not all are supported. | |
| static int | naevL_cache (lua_State *L) |
| Gets the global Lua runtime cache. This is shared among all environments and is cleared when the game is closed. | |
| static int | naevL_trigger (lua_State *L) |
| Triggers manually a hook stack. This is run deferred (next frame). Meant mainly to be used with hook.custom, but can work with other hooks too (if you know what you are doing). | |
| static int | naevL_claimTest (lua_State *L) |
| Tests a claim of a system or strings. | |
| static int | naevL_plugins (lua_State *L) |
| Gets the list of available plugins. | |
| static int | naevL_menuInfo (lua_State *L) |
| Opens the info menu window. | |
| static int | naevL_menuSmall (lua_State *L) |
| Opens the small menu window. | |
| static int | naevL_isPaused (lua_State *L) |
| Checks to see if the game is paused. | |
| static int | naevL_pause (lua_State *L) |
| Pauses the game. | |
| static int | naevL_unpause (lua_State *L) |
| Unpauses the game. | |
| static int | naevL_hasTextInput (lua_State *L) |
| Checks to see if text inputting is enabled. | |
| static int | naevL_setTextInput (lua_State *L) |
| Enables or disables text inputting. | |
| static int | naevL_unit (lua_State *L) |
| Gets the translated string corresponding to an in-game unit. Lua function parameter:[opt=nil] string str Name of the unit to get or nil to get a table with all of them. Lua return parameter: Translated string corresponding to the unit or table of all strings if no parameter is passed. | |
| static int | naevL_quadtreeParams (lua_State *L) |
| Modifies the Naev internal quadtree lookup parameters. | |
| static int | naevL_difficulty (lua_State *L) |
| Gets information about the current difficulty setting. | |
| int | nlua_loadNaev (nlua_env env) |
| Loads the Naev Lua library. | |
Variables | |
| static int | cache_table = LUA_NOREF |
| static const luaL_Reg | naev_methods [] |
| static const char * | unittbl [] |
Contains Naev generic Lua bindings.
Definition in file nlua_naev.c.
| #define BOOL | ( | x | ) |
| #define INTEGER | ( | x | ) |
| #define PUSH_BOOL | ( | L, | |
| name, | |||
| value ) |
Definition at line 574 of file nlua_naev.c.
| #define PUSH_DOUBLE | ( | L, | |
| name, | |||
| value ) |
Definition at line 566 of file nlua_naev.c.
| #define PUSH_INT | ( | L, | |
| name, | |||
| value ) |
Definition at line 570 of file nlua_naev.c.
| #define PUSH_STRING | ( | L, | |
| name, | |||
| value ) |
Definition at line 562 of file nlua_naev.c.
| #define setboolfield | ( | L, | |
| key, | |||
| value ) |
| #define setfield | ( | L, | |
| key, | |||
| value ) |
| #define STRING | ( | x | ) |
|
static |
Gets the global Lua runtime cache. This is shared among all environments and is cleared when the game is closed.
Lua usage parameter: c = naev.cache()
Lua return parameter: table The Lua global cache.
| L | Lua State |
Lua function: cache
Definition at line 678 of file nlua_naev.c.
|
static |
Tests a claim of a system or strings.
Lua usage parameter: if not naev.claimTest( { system.get("Gamma Polaris") } ) then print("Failed to claim!") end
Lua function parameter: System|String|{System,String...} params Table of systems/strings to claim or a single system/string. Lua function parameter:[opt=false] boolean inclusive Whether or not to allow the claim to include other inclusive claims. Multiple missions/events can inclusively claim the same system, but only one system can exclusively claim it. Lua return parameter: boolean true if it is possible to claim, false otherwise.
| L | Lua State |
Lua function: claimTest
Definition at line 734 of file nlua_naev.c.
|
static |
Gets the approximate CPU processing time.
Lua return parameter: number Seconds elapsed since start of the process.
| L | Lua State |
Lua function: clock
Definition at line 333 of file nlua_naev.c.
|
static |
Gets the configuration information.
Lua return parameter: table Table of configuration values as they appear in the configuration file.
| L | Lua State |
Lua function: conf
Definition at line 585 of file nlua_naev.c.
|
static |
Sets configuration variables. Note that not all are supported.
Lua function parameter: string name Configuration variable name. Lua function parameter: number|string value Value to set to.
| L | Lua State |
Lua function: confSet
Definition at line 662 of file nlua_naev.c.
|
static |
Equivalent to os.date from standard Lua.
| L | Lua State |
Lua function: date
Definition at line 239 of file nlua_naev.c.
|
static |
Gets information about the current difficulty setting.
Lua function parameter: boolean internal Whether or not to get values using the internal format, or a human readable format. Lua return parameter: string Name (untranslated) of the difficulty setting. Lua return parameter: table Table containing the ship stats (name is key, while value is value).
| L | Lua State |
Lua function: difficulty
Definition at line 1024 of file nlua_naev.c.
|
static |
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.
Lua usage parameter: naev.eventReload( "Some Event" ) Lua function parameter: string evtname Name of the event to start. Lua return parameter: boolean true on success.
| L | Lua State |
Lua function: eventReload
Definition at line 508 of file nlua_naev.c.
|
static |
Starts an event, does not start check conditions.
Lua usage parameter: naev.eventStart( "Some Event" ) Lua function parameter: string evtname Name of the event to start. Lua return parameter: boolean true on success.
| L | Lua State |
Lua function: eventStart
Definition at line 423 of file nlua_naev.c.
|
static |
Gets the current game FPS as displayed to the player.
Lua return parameter: number Current FPS as displayed to the player.
| L | Lua State |
Lua function: fps
Definition at line 345 of file nlua_naev.c.
|
static |
Checks to see if text inputting is enabled.
Lua return parameter: boolean Whether or not text inputting is enabled.
| L | Lua State |
Lua function: hasTextInput
Definition at line 925 of file nlua_naev.c.
|
static |
Checks to see if the game is paused.
Lua return parameter: boolean Whether or not the game is currently paused.
| L | Lua State |
Lua function: pause
Definition at line 886 of file nlua_naev.c.
|
static |
Gets whether or not the universe is being simulated or not.
Lua return parameter: boolean true if the world is being simulated.
| L | Lua State |
Lua function: isSimulation
Definition at line 556 of file nlua_naev.c.
|
static |
Disables all inputs.
Lua usage parameter: naev.keyDisableAll() – Disables all inputs
| L | Lua State |
Lua function: keyDisableAll
Definition at line 408 of file nlua_naev.c.
|
static |
Disables or enables a specific keybinding.
Use with caution, this can make the player get stuck.
Lua usage parameter: naev.keyEnable( "accel", false ) – Disables the acceleration key Lua function parameter: string keyname Name of the key to disable (for example "accel"). Lua function parameter:[opt=false] boolean enable Whether to enable or disable.
| L | Lua State |
Lua function: keyEnable
Definition at line 380 of file nlua_naev.c.
|
static |
Enables all inputs.
Lua usage parameter: naev.keyEnableAll() – Enables all inputs
| L | Lua State |
Lua function: keyEnableAll
Definition at line 395 of file nlua_naev.c.
|
static |
Gets a human-readable name for the key bound to a function.
Lua usage parameter: bindname = naev.keyGet( "accel" )
Lua function parameter: string keyname Name of the keybinding to get value of. Valid values are listed in src/input.c: keybind_info.
| L | Lua State |
Lua function: keyGet
Definition at line 360 of file nlua_naev.c.
|
static |
Gets the current language locale.
Lua return parameter: string Current language locale (such as "en" for English, "de" for German, or "ja" for Japanese).
| L | Lua State |
Lua function: language
Definition at line 212 of file nlua_naev.c.
|
static |
Gets how many days it has been since the player last played Naev.
Lua return parameter: number Number of days since the player last played. Lua return parameter: number Number of days since any of the save games were played.
| L | Lua State |
Lua function: lastplayed
Definition at line 225 of file nlua_naev.c.
|
static |
Opens the info menu window.
Possible window targets are:
Lua usage parameter: naev.menuInfo( "ship" ) – Opens ship tab
Lua function parameter:[opt="main"] string window parameter indicating the tab to open at.
| L | Lua State |
Lua function: menuInfo
Definition at line 824 of file nlua_naev.c.
|
static |
Opens the small menu window.
Lua usage parameter: naev.menuSmall()
Lua function parameter:[opt=false] boolean info Show the info button. Lua function parameter:[opt=false] boolean options Show the options button. Lua function parameter:[opt=false] boolean allowsave Allow saving the game from the menu (either directly or by exiting the game from the menu).
| L | Lua State |
Lua function: menuSmall
Definition at line 873 of file nlua_naev.c.
|
static |
Lists all the missions in the game.
Lua return parameter: table A table of all the missions in the game, each as a table.
| L | Lua State |
Lua function: missionList
Definition at line 442 of file nlua_naev.c.
|
static |
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.
Lua usage parameter: naev.missionReload( "Some Mission" ) Lua function parameter: string misnname Name of the mission to start. Lua return parameter: boolean true on success.
| L | Lua State |
Lua function: missionReload
Definition at line 527 of file nlua_naev.c.
|
static |
Starts a mission, does no check start conditions.
Lua usage parameter: naev.missionStart( "Some Mission" ) Lua function parameter: string misnname Name of the mission to start. Lua return parameter: boolean true if mission was either accepted, or started without misn.finish() getting called in create. Lua return parameter: boolean true whether or not the mission was accepted.
| L | Lua State |
Lua function: missionStart
Definition at line 463 of file nlua_naev.c.
|
static |
Tests a missions conditionals to see if it can be started by the player.
Note that this tests the Lua conditionals, not the create function, so it may be possible that even though naev.missionTest returns true, the player can still not start the mission.
Lua usage parameter: naev.missionTest( "Some Mission" ) Lua function parameter: string misnname Name of the mission to test. Lua return parameter: boolean true if the mission can be can be started, or false otherwise.
| L | Lua State |
Lua function: missionTest
Definition at line 492 of file nlua_naev.c.
|
static |
Pauses the game.
| L | Lua State |
Lua function: pause
Definition at line 897 of file nlua_naev.c.
|
static |
Gets the list of available plugins.
Lua return parameter: table Table containing the list of plugins.
| L | Lua State |
Lua function: plugins
Definition at line 768 of file nlua_naev.c.
|
static |
Modifies the Naev internal quadtree lookup parameters.
Lua function parameter: number max_elem Maximum amount of elements to allow in a leaf node. Lua function parameter: number depth depth Maximum depth to allow.
| L | Lua State |
Lua function: quadtreeParams
Definition at line 1006 of file nlua_naev.c.
|
static |
Enables or disables text inputting.
Lua function parameter: boolean enable Whether text input events should be enabled. Lua function parameter: integer Text rectangle x position. Lua function parameter: integer Text rectangle y position. Lua function parameter: integer Text rectangle width. Lua function parameter: integer Text rectangle height.
| L | Lua State |
Lua function: setTextInput
Definition at line 941 of file nlua_naev.c.
|
static |
Reloads all the Naev shaders excluding those created by the shader library.
| L | Lua State |
Lua function: shadersReload
Definition at line 542 of file nlua_naev.c.
|
static |
Gets the seconds since the program started running.
Useful for doing timing on Lua functions.
Lua return parameter: number The seconds since the application started running.
| L | Lua State |
Lua function: ticks
Definition at line 320 of file nlua_naev.c.
|
static |
Gets the game seconds since the program started running.
These are modified by whatever speed up the player has.
Lua return parameter: number The seconds since the application started running.
| L | Lua State |
Lua function: ticksGame
Definition at line 306 of file nlua_naev.c.
|
static |
Triggers manually a hook stack. This is run deferred (next frame). Meant mainly to be used with hook.custom, but can work with other hooks too (if you know what you are doing).
Lua usage parameter: naev.trigger( "my_event", data ) – data will be passed to the receiving end
Lua function parameter: string hookname Name of the hook to be run. Lua function parameter: arg Parameter to pass to the hooks.
| L | Lua State |
Lua function: trigger
Definition at line 699 of file nlua_naev.c.
|
static |
Gets the translated string corresponding to an in-game unit. Lua function parameter:[opt=nil] string str Name of the unit to get or nil to get a table with all of them. Lua return parameter: Translated string corresponding to the unit or table of all strings if no parameter is passed.
| L | Lua State |
Lua function: unit
Definition at line 975 of file nlua_naev.c.
|
static |
Unpauses the game.
Can not be run while landed.
| L | Lua State |
Lua function: unpause
Definition at line 911 of file nlua_naev.c.
|
static |
Naev generic Lua bindings.
Lua module: naev
Gets the version of Naev and the save game.
Lua usage parameter: game_version, save_version = naev.version()
Lua return parameter: string The version of the game. Lua return parameter: string Version of current loaded save or nil if not loaded.
| L | Lua State |
Lua function: version
Definition at line 163 of file nlua_naev.c.
|
static |
Tests two semver version strings.
Lua function parameter: string v1 Version 1 to test. Lua function parameter: string v2 Version 2 to test. Lua return parameter: number Positive if v1 is newer or negative if v2 is newer.
| L | Lua State |
Lua function: versionTest
Definition at line 181 of file nlua_naev.c.
| int nlua_loadNaev | ( | nlua_env | env | ) |
Loads the Naev Lua library.
| env | Lua environment. |
Definition at line 135 of file nlua_naev.c.
|
static |
Definition at line 38 of file nlua_naev.c.
|
static |
Naev Lua methods.
Definition at line 84 of file nlua_naev.c.
|
static |
Definition at line 959 of file nlua_naev.c.