naev 0.10.4
nlua_naev.c
Go to the documentation of this file.
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
10#include <lauxlib.h>
11
12#include "naev.h"
15#include "nlua_naev.h"
16
17#include "array.h"
18#include "console.h"
19#include "hook.h"
20#include "input.h"
21#include "land.h"
22#include "log.h"
23#include "info.h"
24#include "menu.h"
25#include "nlua_evt.h"
26#include "nlua_misn.h"
27#include "nlua_system.h"
28#include "nluadef.h"
29#include "nstring.h"
30#include "pause.h"
31#include "player.h"
32#include "plugin.h"
33#include "semver.h"
34
35static int cache_table = LUA_NOREF; /* No reference. */
36
37/* Naev methods. */
38static int naevL_version( lua_State *L );
39static int naevL_versionTest( lua_State *L );
40static int naevL_language( lua_State *L );
41static int naevL_lastplayed( lua_State *L );
42static int naevL_ticks( lua_State *L );
43static int naevL_ticksGame( lua_State *L );
44static int naevL_clock( lua_State *L );
45static int naevL_keyGet( lua_State *L );
46static int naevL_keyEnable( lua_State *L );
47static int naevL_keyEnableAll( lua_State *L );
48static int naevL_keyDisableAll( lua_State *L );
49static int naevL_eventStart( lua_State *L );
50static int naevL_eventReload( lua_State *L );
51static int naevL_missionStart( lua_State *L );
52static int naevL_missionReload( lua_State *L );
53static int naevL_shadersReload( lua_State *L );
54static int naevL_isSimulation( lua_State *L );
55static int naevL_conf( lua_State *L );
56static int naevL_confSet( lua_State *L );
57static int naevL_cache( lua_State *L );
58static int naevL_trigger( lua_State *L );
59static int naevL_claimTest( lua_State *L );
60static int naevL_plugins( lua_State *L );
61static int naevL_menuInfo( lua_State *L );
62static int naevL_menuSmall( lua_State *L );
63static int naevL_isPaused( lua_State *L );
64static int naevL_pause( lua_State *L );
65static int naevL_unpause( lua_State *L );
66static int naevL_hasTextInput( lua_State *L );
67static int naevL_setTextInput( lua_State *L );
68#if DEBUGGING
69static int naevL_envs( lua_State *L );
70#endif /* DEBUGGING */
71static const luaL_Reg naev_methods[] = {
72 { "version", naevL_version },
73 { "versionTest", naevL_versionTest },
74 { "language", naevL_language },
75 { "lastplayed", naevL_lastplayed },
76 { "ticks", naevL_ticks },
77 { "ticksGame", naevL_ticksGame },
78 { "clock", naevL_clock },
79 { "keyGet", naevL_keyGet },
80 { "keyEnable", naevL_keyEnable },
81 { "keyEnableAll", naevL_keyEnableAll },
82 { "keyDisableAll", naevL_keyDisableAll },
83 { "eventStart", naevL_eventStart },
84 { "eventReload", naevL_eventReload },
85 { "missionStart", naevL_missionStart },
86 { "missionReload", naevL_missionReload },
87 { "shadersReload", naevL_shadersReload },
88 { "isSimulation", naevL_isSimulation },
89 { "conf", naevL_conf },
90 { "confSet", naevL_confSet },
91 { "cache", naevL_cache },
92 { "trigger", naevL_trigger },
93 { "claimTest", naevL_claimTest },
94 { "plugins", naevL_plugins },
95 { "menuInfo", naevL_menuInfo },
96 { "menuSmall", naevL_menuSmall },
97 { "isPaused", naevL_isPaused },
98 { "pause", naevL_pause },
99 { "unpause", naevL_unpause },
100 { "hasTextInput", naevL_hasTextInput },
101 { "setTextInput", naevL_setTextInput },
102#if DEBUGGING
103 { "envs", naevL_envs },
104#endif /* DEBUGGING */
105 {0,0}
106};
114int nlua_loadNaev( nlua_env env )
115{
116 nlua_register(env, "naev", naev_methods, 0);
117
118 /* Create cache. */
119 if (cache_table == LUA_NOREF) {
120 lua_newtable( naevL );
121 cache_table = luaL_ref(naevL, LUA_REGISTRYINDEX);
122 }
123
124 return 0;
125}
126
142static int naevL_version( lua_State *L )
143{
144 lua_pushstring( L, naev_version(0) );
145 if (player.loaded_version==NULL)
146 lua_pushnil( L );
147 else
148 lua_pushstring( L, player.loaded_version );
149 return 2;
150}
151
160static int naevL_versionTest( lua_State *L )
161{
162 const char *s1, *s2;
163 semver_t sv1, sv2;
164 int res;
165 /* Parse inputs. */
166 s1 = luaL_checkstring(L,1);
167 s2 = luaL_checkstring(L,2);
168 if (semver_parse( s1, &sv1 ))
169 WARN( _("Failed to parse version string '%s'!"), s1 );
170 if (semver_parse( s2, &sv2 ))
171 WARN( _("Failed to parse version string '%s'!"), s2 );
172
173 /* Check version. */
174 res = semver_compare( sv1, sv2 );
175
176 /* Cleanup. */
177 semver_free( &sv1 );
178 semver_free( &sv2 );
179
180 lua_pushinteger(L,res);
181 return 1;
182}
183
190static int naevL_language( lua_State *L )
191{
192 lua_pushstring( L, gettext_getLanguage() );
193 return 1;
194}
195
203static int naevL_lastplayed( lua_State *L )
204{
205 double d = difftime( time(NULL), player.last_played );
206 double g = difftime( time(NULL), conf.last_played );
207 lua_pushnumber(L, d/(3600.*24.)); /*< convert to days */
208 lua_pushnumber(L, g/(3600.*24.)); /*< convert to days */
209 return 2;
210}
211
220static int naevL_ticksGame( lua_State *L )
221{
222 lua_pushnumber(L, elapsed_time_mod );
223 return 1;
224}
225
234static int naevL_ticks( lua_State *L )
235{
236 lua_pushnumber(L, (double)SDL_GetTicks() / 1000.);
237 return 1;
238}
239
246static int naevL_clock( lua_State *L )
247{
248 lua_pushnumber(L, (double)clock() / (double)CLOCKS_PER_SEC );
249 return 1;
250}
251
260static int naevL_keyGet( lua_State *L )
261{
262 char buf[128];
263 const char *keyname = luaL_checkstring( L, 1 );
264
265 input_getKeybindDisplay( keyname, buf, sizeof(buf) );
266 lua_pushstring( L, buf );
267
268 return 1;
269}
270
281static int naevL_keyEnable( lua_State *L )
282{
283 const char *key = luaL_checkstring(L,1);
284 int enable = lua_toboolean(L,2);
285
286 input_toggleEnable( key, enable );
287 return 0;
288}
289
296static int naevL_keyEnableAll( lua_State *L )
297{
298 (void) L;
300 return 0;
301}
302
309static int naevL_keyDisableAll( lua_State *L )
310{
311 (void) L;
313 return 0;
314}
315
324static int naevL_eventStart( lua_State *L )
325{
326 const char *str = luaL_checkstring(L, 1);
327 int ret = event_start( str, NULL );
328
329 if (cli_isOpen() && landed)
330 bar_regen();
331
332 lua_pushboolean( L, !ret );
333 return 1;
334}
335
345static int naevL_missionStart( lua_State *L )
346{
347 const char *str = luaL_checkstring(L, 1);
348 int ret = mission_start( str, NULL );
349
350 if (cli_isOpen() && landed)
351 bar_regen();
352
353 lua_pushboolean( L, (ret==0) || (ret==3) );
354 lua_pushboolean( L, (ret==3) );
355 return 2;
356}
357
367static int naevL_eventReload( lua_State *L )
368{
369 const char *str = luaL_checkstring(L, 1);
370 int ret = event_reload( str );
371
372 lua_pushboolean( L, !ret );
373 return 1;
374}
375
385static int naevL_missionReload( lua_State *L )
386{
387 const char *str = luaL_checkstring(L, 1);
388 int ret = mission_reload( str );
389
390 lua_pushboolean( L, !ret );
391 return 1;
392}
393
399static int naevL_shadersReload( lua_State *L )
400{
401 (void) L;
402 shaders_unload();
403 shaders_load();
404 return 0;
405}
406
413static int naevL_isSimulation( lua_State *L )
414{
415 lua_pushboolean( L, space_isSimulation() );
416 return 1;
417}
418
419#define PUSH_STRING( L, name, value ) \
420lua_pushstring( L, name ); \
421lua_pushstring( L, value ); \
422lua_rawset( L, -3 )
423#define PUSH_DOUBLE( L, name, value ) \
424lua_pushstring( L, name ); \
425lua_pushnumber( L, value ); \
426lua_rawset( L, -3 )
427#define PUSH_INT( L, name, value ) \
428lua_pushstring( L, name ); \
429lua_pushinteger( L, value ); \
430lua_rawset( L, -3 )
431#define PUSH_BOOL( L, name, value ) \
432lua_pushstring( L, name ); \
433lua_pushboolean( L, value ); \
434lua_rawset( L, -3 )
441static int naevL_conf( lua_State *L )
442{
443 lua_newtable(L);
444 PUSH_STRING( L, "data", conf.ndata );
445 PUSH_STRING( L, "language", conf.language );
446 PUSH_STRING( L, "difficulty", conf.difficulty );
447 PUSH_INT( L, "fsaa", conf.fsaa );
448 PUSH_BOOL( L, "vsync", conf.vsync );
449 PUSH_INT( L, "width", conf.width );
450 PUSH_INT( L, "height", conf.height );
451 PUSH_DOUBLE( L, "scalefactor", conf.scalefactor );
452 PUSH_DOUBLE( L, "nebu_scale", conf.nebu_scale );
453 PUSH_BOOL( L, "fullscreen", conf.fullscreen );
454 PUSH_BOOL( L, "modesetting", conf.modesetting );
455 PUSH_BOOL( L, "notresizable", conf.notresizable );
456 PUSH_BOOL( L, "borderless", conf.borderless );
457 PUSH_BOOL( L, "minimize", conf.minimize );
458 PUSH_BOOL( L, "colorblind", conf.colorblind );
459 PUSH_DOUBLE( L, "bg_brightness", conf.bg_brightness );
460 PUSH_DOUBLE( L, "gamma_correction", conf.gamma_correction );
461 PUSH_BOOL( L, "background_fancy", conf.background_fancy );
462 PUSH_BOOL( L, "showfps", conf.fps_show );
463 PUSH_INT( L, "maxfps", conf.fps_max );
464 PUSH_BOOL( L, "showpause", conf.pause_show );
465 PUSH_BOOL( L, "al_efx", conf.al_efx );
466 PUSH_BOOL( L, "nosound", conf.nosound );
467 PUSH_DOUBLE( L, "sound", conf.sound );
468 PUSH_DOUBLE( L, "music", conf.music );
469 /* joystick */
470 PUSH_INT( L, "mesg_visible", conf.mesg_visible );
471 PUSH_DOUBLE( L, "map_overlay_opacity", conf.map_overlay_opacity );
472 PUSH_BOOL( L, "big_icons", conf.big_icons );
473 PUSH_INT( L, "repeat_delay", conf.repeat_delay );
474 PUSH_INT( L, "repeat_freq", conf.repeat_freq );
475 PUSH_BOOL( L, "zoom_manual", conf.zoom_manual );
476 PUSH_DOUBLE( L, "zoom_far", conf.zoom_far );
477 PUSH_DOUBLE( L, "zoom_near", conf.zoom_near );
478 PUSH_DOUBLE( L, "zoom_speed", conf.zoom_speed );
479 PUSH_DOUBLE( L, "zoom_stars", conf.zoom_stars );
480 PUSH_INT( L, "font_size_console", conf.font_size_console );
481 PUSH_INT( L, "font_size_intro", conf.font_size_intro );
482 PUSH_INT( L, "font_size_def", conf.font_size_def );
483 PUSH_INT( L, "font_size_small", conf.font_size_small );
484 PUSH_DOUBLE( L, "compression_velocity", conf.compression_velocity );
485 PUSH_DOUBLE( L, "compression_mult", conf.compression_mult );
486 PUSH_BOOL( L, "redirect_file", conf.redirect_file );
487 PUSH_BOOL( L, "save_compress", conf.save_compress );
488 PUSH_INT( L, "doubletap_sensitivity", conf.doubletap_sens );
489 PUSH_BOOL( L, "mouse_fly", conf.mouse_fly );
490 PUSH_INT( L, "mouse_thrust", conf.mouse_thrust );
491 PUSH_DOUBLE( L, "mouse_doubleclick", conf.mouse_doubleclick );
492 PUSH_DOUBLE( L, "autonav_reset_dist", conf.autonav_reset_dist );
493 PUSH_DOUBLE( L, "autonav_reset_shield", conf.autonav_reset_shield );
494 PUSH_BOOL( L, "devmode", conf.devmode );
495 PUSH_BOOL( L, "devautosave", conf.devautosave );
496 PUSH_BOOL( L, "lua_enet", conf.lua_enet );
497 PUSH_BOOL( L, "lua_repl", conf.lua_repl );
498 PUSH_BOOL( L, "conf_nosave", conf.nosave );
499 PUSH_STRING( L, "last_version", conf.lastversion );
500 PUSH_BOOL( L, "translation_warning_seen", conf.translation_warning_seen );
501 PUSH_BOOL( L, "fpu_except", conf.fpu_except );
502 PUSH_STRING( L, "dev_save_sys", conf.dev_save_sys );
503 PUSH_STRING( L, "dev_save_map", conf.dev_save_map );
504 PUSH_STRING( L, "dev_save_spob", conf.dev_save_spob );
505 return 1;
506}
507#undef PUSH_STRING
508#undef PUSH_DOUBLE
509#undef PUSH_INT
510#undef PUSH_BOOL
511
519static int naevL_confSet( lua_State *L )
520{
521 (void) L;
522 /* TODO implement. */
523 NLUA_ERROR(L, _("unimplemented"));
524 return 0;
525}
526
536static int naevL_cache( lua_State *L )
537{
538 lua_rawgeti( L, LUA_REGISTRYINDEX, cache_table );
539 return 1;
540}
541
554static int naevL_trigger( lua_State *L )
555{
556 HookParam hp[HOOK_MAX_PARAM];
557 const char *hookname = luaL_checkstring(L,1);
558
559 /* Set up hooks. */
560 if (lua_isnoneornil(L,2)) {
561 /* Since this doesn't get saved and is triggered by Lua code, we can
562 * actually pass references here. */
563 hp[0].type = HOOK_PARAM_REF;
564 lua_pushvalue(L,2);
565 hp[0].u.ref = luaL_ref( L, LUA_REGISTRYINDEX );
566 hp[1].type = HOOK_PARAM_SENTINEL;
567 }
568 else
569 hp[0].type = HOOK_PARAM_SENTINEL;
570
571 /* Run the deferred hooks. */
572 hooks_runParamDeferred( hookname, hp );
573 return 0;
574}
575
586static int naevL_claimTest( lua_State *L )
587{
588 int inclusive = lua_toboolean(L,2);
589 Claim_t *claim = claim_create( !inclusive );
590
591 if (lua_istable(L,1)) {
592 /* Iterate over table. */
593 lua_pushnil(L);
594 while (lua_next(L, 1) != 0) {
595 if (lua_issystem(L,-1))
596 claim_addSys( claim, lua_tosystem( L, -1 ) );
597 else if (lua_isstring(L,-1))
598 claim_addStr( claim, lua_tostring( L, -1 ) );
599 lua_pop(L,1);
600 }
601 }
602 else if (lua_issystem(L, 1))
603 claim_addSys( claim, lua_tosystem( L, 1 ) );
604 else if (lua_isstring(L, 1))
605 claim_addStr( claim, lua_tostring( L, 1 ) );
606 else
607 NLUA_INVALID_PARAMETER(L);
608
609 /* Only test, but don't apply case. */
610 lua_pushboolean( L, !claim_test( claim ) );
611 claim_destroy( claim );
612 return 1;
613}
614
621static int naevL_plugins( lua_State *L )
622{
623 const plugin_t *plugins = plugin_list();
624 lua_newtable(L);
625 for (int i=0; i<array_size(plugins); i++) {
626 const plugin_t *plg = &plugins[i];
627 lua_newtable(L);
628
629#define STRING(x) \
630 lua_pushstring(L,plg->x); \
631 lua_setfield(L,-2,#x)
632#define INTEGER(x) \
633 lua_pushinteger(L,plg->x); \
634 lua_setfield(L,-2,#x)
635#define BOOL(x) \
636 lua_pushboolean(L,plg->x); \
637 lua_setfield(L,-2,#x)
638
639 STRING(name);
640 STRING(author);
641 STRING(version);
642 STRING(description);
643 STRING(compatibility);
644 STRING(mountpoint);
645
646 INTEGER(priority);
647
648 BOOL(compatible);
649 BOOL(total_conversion);
650
651#undef BOOL
652#undef INTEGER
653#undef STRING
654
655 lua_rawseti(L,-2,i+1);
656 }
657 return 1;
658}
659
676static int naevL_menuInfo( lua_State *L )
677{
678 const char *str;
679 int window;
680
681
682 if (menu_open)
683 return 0;
684
685 if (lua_gettop(L) > 0)
686 str = luaL_checkstring(L,1);
687 else {
688 /* No parameter. */
690 return 0;
691 }
692
693 /* Parse string. */
694 if (strcasecmp( str, "main" )==0)
695 window = INFO_MAIN;
696 else if (strcasecmp( str, "ship" )==0)
697 window = INFO_SHIP;
698 else if (strcasecmp( str, "weapons" )==0)
699 window = INFO_WEAPONS;
700 else if (strcasecmp( str, "cargo" )==0)
701 window = INFO_CARGO;
702 else if (strcasecmp( str, "missions" )==0)
703 window = INFO_MISSIONS;
704 else if (strcasecmp( str, "standings" )==0)
705 window = INFO_STANDINGS;
706 else {
707 NLUA_ERROR(L,_("Invalid window info name '%s'."), str);
708 return 0;
709 }
710
711 /* Open window. */
712 menu_info( window );
713
714 return 0;
715}
716
727static int naevL_menuSmall( lua_State *L )
728{
729 menu_small( 0, lua_toboolean(L,1), lua_toboolean(L,2), lua_toboolean(L,3) );
730 return 0;
731}
732
739static int naevL_isPaused( lua_State *L )
740{
741 lua_pushboolean( L, paused );
742 return 1;
743}
744
750static int naevL_pause( lua_State *L )
751{
752 (void) L;
753 pause_game();
754 return 0;
755}
756
764static int naevL_unpause( lua_State *L )
765{
766 if (landed)
767 NLUA_ERROR(L, _("Unable to unpause the game when landed!"));
768 unpause_game();
769 return 0;
770}
771
778static int naevL_hasTextInput( lua_State *L )
779{
780 lua_pushboolean( L, SDL_EventState( SDL_TEXTINPUT, SDL_QUERY ) == SDL_TRUE );
781 return 1;
782}
783
794static int naevL_setTextInput( lua_State *L )
795{
796 if (lua_toboolean(L,1)) {
797 SDL_Rect input_pos;
798 input_pos.x = luaL_checkinteger(L,2);
799 input_pos.y = luaL_checkinteger(L,3);
800 input_pos.w = luaL_checkinteger(L,4);
801 input_pos.h = luaL_checkinteger(L,5);
802 SDL_EventState( SDL_TEXTINPUT, SDL_ENABLE );
803 SDL_StartTextInput();
804 SDL_SetTextInputRect( &input_pos );
805 }
806 else {
807 SDL_StopTextInput();
808 SDL_EventState( SDL_TEXTINPUT, SDL_DISABLE );
809 }
810 return 0;
811}
812
813#if DEBUGGING
822static int naevL_envs( lua_State *L )
823{
824 nlua_pushEnvTable( L );
825 return 1;
826}
827#endif /* DEBUGGING */
Provides macros to work with dynamic arrays.
static ALWAYS_INLINE int array_size(const void *array)
Returns number of elements in the array.
Definition: array.h:168
int claim_test(const Claim_t *claim)
Tests to see if a system claim would have collisions.
Definition: claim.c:112
void claim_destroy(Claim_t *claim)
Destroys a system claim.
Definition: claim.c:189
int claim_addStr(Claim_t *claim, const char *str)
Adds a string claim to a claim.
Definition: claim.c:59
int claim_addSys(Claim_t *claim, int ss_id)
Adds a claim to a system claim.
Definition: claim.c:77
Claim_t * claim_create(int exclusive)
Creates a system claim.
Definition: claim.c:42
int event_start(const char *name, unsigned int *id)
Starts an event.
Definition: event.c:119
const char * gettext_getLanguage(void)
Gets the active (primary) translation language. Even in case of a complex locale, this will be the na...
Definition: gettext.c:93
int hooks_runParamDeferred(const char *stack, const HookParam *param)
Runs all the hooks of stack in the next frame. Does not trigger right away.
Definition: hook.c:935
Handles the info menu.
#define INFO_SHIP
Definition: info.h:9
#define INFO_DEFAULT
Definition: info.h:16
#define INFO_CARGO
Definition: info.h:11
#define INFO_WEAPONS
Definition: info.h:10
#define INFO_STANDINGS
Definition: info.h:13
#define INFO_MAIN
Definition: info.h:8
#define INFO_MISSIONS
Definition: info.h:12
void menu_info(int window)
Opens the information menu.
Definition: info.c:278
void input_disableAll(void)
Disables all the keybinds.
Definition: input.c:351
void input_toggleEnable(const char *key, int enable)
Enables or disables a keybind.
Definition: input.c:360
void input_enableAll(void)
Enables all the keybinds.
Definition: input.c:342
void input_getKeybindDisplay(const char *keybind, char *buf, int len)
Gets the display name (translated and human-readable) of a keybind.
Definition: input.c:458
void bar_regen(void)
Regenerates the bar list.
Definition: land.c:452
int landed
Definition: land.c:74
Handles the important game menus.
void menu_small(int docheck, int info, int options, int allowsave)
Opens the small in-game menu.
Definition: menu.c:416
int menu_open
Definition: menu.c:67
int mission_start(const char *name, unsigned int *id)
Starts a mission.
Definition: mission.c:338
double elapsed_time_mod
Definition: naev.c:119
Header file with generic functions and naev-specifics.
const char * naev_version(int long_version)
Returns the version in a human readable string.
Definition: naev_version.c:25
static int naevL_isSimulation(lua_State *L)
Gets whether or not the universe is being simulated or not.
Definition: nlua_naev.c:413
static int naevL_menuInfo(lua_State *L)
Opens the info menu window.
Definition: nlua_naev.c:676
static int naevL_conf(lua_State *L)
Gets the configuration information.
Definition: nlua_naev.c:441
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 st...
Definition: nlua_naev.c:367
static int naevL_shadersReload(lua_State *L)
Reloads all the Naev shaders excluding those created by the shader library.
Definition: nlua_naev.c:399
static int naevL_lastplayed(lua_State *L)
Gets how many days it has been since the player last played Naev.
Definition: nlua_naev.c:203
static int naevL_confSet(lua_State *L)
Sets configuration variables. Note that not all are supported.
Definition: nlua_naev.c:519
static int naevL_claimTest(lua_State *L)
Tests a claim of a system or strings.
Definition: nlua_naev.c:586
static int naevL_missionStart(lua_State *L)
Starts a mission, does no check start conditions.
Definition: nlua_naev.c:345
static int naevL_keyDisableAll(lua_State *L)
Disables all inputs.
Definition: nlua_naev.c:309
int nlua_loadNaev(nlua_env env)
Loads the Naev Lua library.
Definition: nlua_naev.c:114
static int naevL_keyGet(lua_State *L)
Gets a human-readable name for the key bound to a function.
Definition: nlua_naev.c:260
static int naevL_pause(lua_State *L)
Pauses the game.
Definition: nlua_naev.c:750
static int naevL_clock(lua_State *L)
Gets the approximate CPU processing time.
Definition: nlua_naev.c:246
static int naevL_plugins(lua_State *L)
Gets the list of available plugins.
Definition: nlua_naev.c:621
static int naevL_setTextInput(lua_State *L)
Enables or disables text inputting.
Definition: nlua_naev.c:794
static int naevL_menuSmall(lua_State *L)
Opens the small menu window.
Definition: nlua_naev.c:727
static int naevL_hasTextInput(lua_State *L)
Checks to see if text inputting is enabled.
Definition: nlua_naev.c:778
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...
Definition: nlua_naev.c:536
static int naevL_version(lua_State *L)
Naev generic Lua bindings.
Definition: nlua_naev.c:142
static int naevL_keyEnableAll(lua_State *L)
Enables all inputs.
Definition: nlua_naev.c:296
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 s...
Definition: nlua_naev.c:385
static int naevL_keyEnable(lua_State *L)
Disables or enables a specific keybinding.
Definition: nlua_naev.c:281
static int naevL_language(lua_State *L)
Gets the current language locale.
Definition: nlua_naev.c:190
static int naevL_ticks(lua_State *L)
Gets the seconds since the program started running.
Definition: nlua_naev.c:234
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....
Definition: nlua_naev.c:554
static int naevL_isPaused(lua_State *L)
Checks to see if the game is paused.
Definition: nlua_naev.c:739
static int naevL_eventStart(lua_State *L)
Starts an event, does not start check conditions.
Definition: nlua_naev.c:324
static int naevL_versionTest(lua_State *L)
Tests two semver version strings.
Definition: nlua_naev.c:160
static int naevL_unpause(lua_State *L)
Unpauses the game.
Definition: nlua_naev.c:764
static int naevL_ticksGame(lua_State *L)
Gets the game seconds since the program started running.
Definition: nlua_naev.c:220
static const luaL_Reg naev_methods[]
Definition: nlua_naev.c:71
LuaSystem lua_tosystem(lua_State *L, int ind)
Lua system module.
Definition: nlua_system.c:130
int lua_issystem(lua_State *L, int ind)
Checks to see if ind is a system.
Definition: nlua_system.c:201
void pause_game(void)
Pauses the game.
Definition: pause.c:28
int paused
Definition: pause.c:21
void unpause_game(void)
Unpauses the game.
Definition: pause.c:46
Player_t player
Definition: player.c:73
const plugin_t * plugin_list(void)
Returns the list of all the plugins.
Definition: plugin.c:281
static const double d[]
Definition: rng.c:273
int space_isSimulation(void)
returns whether we're just simulating.
Definition: space.c:1482
The actual hook parameter.
Definition: hook.h:35
union HookParam::@4 u
HookParamType type
Definition: hook.h:36
int ref
Definition: hook.h:46
int lua_repl
Definition: conf.h:161
int nosound
Definition: conf.h:107
double scalefactor
Definition: conf.h:90
double zoom_stars
Definition: conf.h:138
char * dev_save_map
Definition: conf.h:172
int font_size_def
Definition: conf.h:143
double autonav_reset_shield
Definition: conf.h:157
int fullscreen
Definition: conf.h:92
int vsync
Definition: conf.h:84
double compression_velocity
Definition: conf.h:148
int colorblind
Definition: conf.h:97
int modesetting
Definition: conf.h:93
int fps_max
Definition: conf.h:114
int width
Definition: conf.h:87
time_t last_played
Definition: conf.h:165
double zoom_speed
Definition: conf.h:137
int minimize
Definition: conf.h:96
int font_size_small
Definition: conf.h:144
char * language
Definition: conf.h:80
int devmode
Definition: conf.h:158
int pause_show
Definition: conf.h:117
int height
Definition: conf.h:88
int mouse_thrust
Definition: conf.h:154
int notresizable
Definition: conf.h:94
int big_icons
Definition: conf.h:126
unsigned int repeat_freq
Definition: conf.h:131
double music
Definition: conf.h:109
double mouse_doubleclick
Definition: conf.h:155
char * ndata
Definition: conf.h:76
double autonav_reset_dist
Definition: conf.h:156
int devautosave
Definition: conf.h:159
int al_efx
Definition: conf.h:106
unsigned int repeat_delay
Definition: conf.h:130
char * difficulty
Definition: conf.h:147
double compression_mult
Definition: conf.h:149
int background_fancy
Definition: conf.h:103
int fps_show
Definition: conf.h:113
int mesg_visible
Definition: conf.h:124
double sound
Definition: conf.h:108
double zoom_far
Definition: conf.h:135
double gamma_correction
Definition: conf.h:102
int nosave
Definition: conf.h:162
unsigned int doubletap_sens
Definition: conf.h:152
int lua_enet
Definition: conf.h:160
double bg_brightness
Definition: conf.h:99
int font_size_console
Definition: conf.h:141
int zoom_manual
Definition: conf.h:134
int save_compress
Definition: conf.h:151
int redirect_file
Definition: conf.h:150
double map_overlay_opacity
Definition: conf.h:125
double nebu_scale
Definition: conf.h:91
char * dev_save_spob
Definition: conf.h:173
int mouse_fly
Definition: conf.h:153
double zoom_near
Definition: conf.h:136
char * lastversion
Definition: conf.h:163
int translation_warning_seen
Definition: conf.h:164
int fsaa
Definition: conf.h:83
int fpu_except
Definition: conf.h:168
int borderless
Definition: conf.h:95
int font_size_intro
Definition: conf.h:142
char * dev_save_sys
Definition: conf.h:171
char * loaded_version
Definition: player.h:121
time_t last_played
Definition: player.h:134
Definition: plugin.h:6