![]() |
naev 0.10.4
|
Contains Naev generic Lua bindings. More...
#include "nlua_naev.h"#include "array.h"#include "console.h"#include "hook.h"#include "input.h"#include "land.h"#include "log.h"#include "info.h"#include "menu.h"#include "nlua_evt.h"#include "nlua_misn.h"#include "nlua_system.h"#include "nluadef.h"#include "nstring.h"#include "pause.h"#include "player.h"#include "plugin.h"#include "semver.h"Go to the source code of this file.
Macros | |
| #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. More... | |
| static int | naevL_versionTest (lua_State *L) |
| Tests two semver version strings. More... | |
| static int | naevL_language (lua_State *L) |
| Gets the current language locale. More... | |
| static int | naevL_lastplayed (lua_State *L) |
| Gets how many days it has been since the player last played Naev. More... | |
| static int | naevL_ticks (lua_State *L) |
| Gets the seconds since the program started running. More... | |
| static int | naevL_ticksGame (lua_State *L) |
| Gets the game seconds since the program started running. More... | |
| static int | naevL_clock (lua_State *L) |
| Gets the approximate CPU processing time. More... | |
| static int | naevL_keyGet (lua_State *L) |
| Gets a human-readable name for the key bound to a function. More... | |
| static int | naevL_keyEnable (lua_State *L) |
| Disables or enables a specific keybinding. More... | |
| static int | naevL_keyEnableAll (lua_State *L) |
| Enables all inputs. More... | |
| static int | naevL_keyDisableAll (lua_State *L) |
| Disables all inputs. More... | |
| static int | naevL_eventStart (lua_State *L) |
| Starts an event, does not start check conditions. More... | |
| 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. More... | |
| static int | naevL_missionStart (lua_State *L) |
| Starts a mission, does no check start conditions. More... | |
| 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. More... | |
| static int | naevL_shadersReload (lua_State *L) |
| Reloads all the Naev shaders excluding those created by the shader library. More... | |
| static int | naevL_isSimulation (lua_State *L) |
| Gets whether or not the universe is being simulated or not. More... | |
| static int | naevL_conf (lua_State *L) |
| Gets the configuration information. More... | |
| static int | naevL_confSet (lua_State *L) |
| Sets configuration variables. Note that not all are supported. More... | |
| 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. More... | |
| 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). More... | |
| static int | naevL_claimTest (lua_State *L) |
| Tests a claim of a system or strings. More... | |
| static int | naevL_plugins (lua_State *L) |
| Gets the list of available plugins. More... | |
| static int | naevL_menuInfo (lua_State *L) |
| Opens the info menu window. More... | |
| static int | naevL_menuSmall (lua_State *L) |
| Opens the small menu window. More... | |
| static int | naevL_isPaused (lua_State *L) |
| Checks to see if the game is paused. More... | |
| static int | naevL_pause (lua_State *L) |
| Pauses the game. More... | |
| static int | naevL_unpause (lua_State *L) |
| Unpauses the game. More... | |
| static int | naevL_hasTextInput (lua_State *L) |
| Checks to see if text inputting is enabled. More... | |
| static int | naevL_setTextInput (lua_State *L) |
| Enables or disables text inputting. More... | |
| int | nlua_loadNaev (nlua_env env) |
| Loads the Naev Lua library. More... | |
Variables | |
| static int | cache_table = LUA_NOREF |
| static const luaL_Reg | naev_methods [] |
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 431 of file nlua_naev.c.
| #define PUSH_DOUBLE | ( | L, | |
| name, | |||
| value | |||
| ) |
Definition at line 423 of file nlua_naev.c.
| #define PUSH_INT | ( | L, | |
| name, | |||
| value | |||
| ) |
Definition at line 427 of file nlua_naev.c.
| #define PUSH_STRING | ( | L, | |
| name, | |||
| value | |||
| ) |
Definition at line 419 of file nlua_naev.c.
| #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 536 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 586 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 246 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 441 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 519 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 367 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 324 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 778 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 739 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 413 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 309 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 281 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 296 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 260 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 190 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 203 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 676 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 727 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 385 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 345 of file nlua_naev.c.
|
static |
Pauses the game.
| L | Lua State |
Lua function: pause
Definition at line 750 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 621 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 794 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 399 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 234 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 220 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 554 of file nlua_naev.c.
|
static |
Unpauses the game.
Can not be run while landed.
| L | Lua State |
Lua function: unpause
Definition at line 764 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 142 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 160 of file nlua_naev.c.
| int nlua_loadNaev | ( | nlua_env | env | ) |
Loads the Naev Lua library.
| env | Lua environment. |
Definition at line 114 of file nlua_naev.c.
|
static |
Definition at line 35 of file nlua_naev.c.
|
static |
Naev Lua methods.
Definition at line 71 of file nlua_naev.c.