forked from love2d-community/love-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
love_api.lua
1367 lines (1366 loc) · 68.4 KB
/
love_api.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
local path = (...):match('(.-)[^%./]+$')
return {
version = '11.4',
functions = {
{
name = 'getVersion',
description = 'Gets the current running version of LÖVE.',
variants = {
{
description = 'For LÖVE versions below 0.9.1, the following variables can be used instead (and still work in 0.9.2 and newer):\n\nlove._version_major\n\nlove._version_minor\n\nlove._version_revision',
returns = {
{
type = 'number',
name = 'major',
description = 'The major version of LÖVE, i.e. 0 for version 0.9.1.',
},
{
type = 'number',
name = 'minor',
description = 'The minor version of LÖVE, i.e. 9 for version 0.9.1.',
},
{
type = 'number',
name = 'revision',
description = 'The revision version of LÖVE, i.e. 1 for version 0.9.1.',
},
{
type = 'string',
name = 'codename',
description = 'The codename of the current version, i.e. \'Baby Inspector\' for version 0.9.1.',
},
},
},
},
},
{
name = 'hasDeprecationOutput',
description = 'Gets whether LÖVE displays warnings when using deprecated functionality. It is disabled by default in fused mode, and enabled by default otherwise.\n\nWhen deprecation output is enabled, the first use of a formally deprecated LÖVE API will show a message at the bottom of the screen for a short time, and print the message to the console.',
variants = {
{
returns = {
{
type = 'boolean',
name = 'enabled',
description = 'Whether deprecation output is enabled.',
},
},
},
},
},
{
name = 'isVersionCompatible',
description = 'Gets whether the given version is compatible with the current running version of LÖVE.',
variants = {
{
arguments = {
{
type = 'string',
name = 'version',
description = 'The version to check (for example \'11.3\' or \'0.10.2\').',
},
},
returns = {
{
type = 'boolean',
name = 'compatible',
description = 'Whether the given version is compatible with the current running version of LÖVE.',
},
},
},
{
arguments = {
{
type = 'number',
name = 'major',
description = 'The major version to check (for example 11 for 11.3 or 0 for 0.10.2).',
},
{
type = 'number',
name = 'minor',
description = 'The minor version to check (for example 3 for 11.3 or 10 for 0.10.2).',
},
{
type = 'number',
name = 'revision',
description = 'The revision of version to check (for example 0 for 11.3 or 2 for 0.10.2).',
},
},
returns = {
{
type = 'boolean',
name = 'compatible',
description = 'Whether the given version is compatible with the current running version of LÖVE.',
},
},
},
},
},
{
name = 'setDeprecationOutput',
description = 'Sets whether LÖVE displays warnings when using deprecated functionality. It is disabled by default in fused mode, and enabled by default otherwise.\n\nWhen deprecation output is enabled, the first use of a formally deprecated LÖVE API will show a message at the bottom of the screen for a short time, and print the message to the console.',
variants = {
{
arguments = {
{
type = 'boolean',
name = 'enable',
description = 'Whether to enable or disable deprecation output.',
},
},
},
},
},
},
callbacks = {
{
name = 'conf',
description = 'If a file called conf.lua is present in your game folder (or .love file), it is run before the LÖVE modules are loaded. You can use this file to overwrite the love.conf function, which is later called by the LÖVE \'boot\' script. Using the love.conf function, you can set some configuration options, and change things like the default size of the window, which modules are loaded, and other stuff.',
variants = {
{
arguments = {
{
type = 'table',
name = 't',
description = 'The love.conf function takes one argument: a table filled with all the default values which you can overwrite to your liking. If you want to change the default window size, for instance, do:\n\nfunction love.conf(t)\n t.window.width = 1024\n t.window.height = 768\nend\n\nIf you don\'t need the physics module or joystick module, do the following.\n\nfunction love.conf(t)\n t.modules.joystick = false\n t.modules.physics = false\nend\n\nSetting unused modules to false is encouraged when you release your game. It reduces startup time slightly (especially if the joystick module is disabled) and reduces memory usage (slightly).\n\nNote that you can\'t disable love.filesystem; it\'s mandatory. The same goes for the love module itself. love.graphics needs love.window to be enabled.',
table = {
{
type = 'string',
name = 'identity',
description = 'This flag determines the name of the save directory for your game. Note that you can only specify the name, not the location where it will be created:\nt.identity = "gabe_HL3" -- Correct\n\nt.identity = "c:/Users/gabe/HL3" -- Incorrect\nAlternatively love.filesystem.setIdentity can be used to set the save directory outside of the config file.',
default = 'nil',
},
{
type = 'boolean',
name = 'appendidentity',
description = 'This flag determines if game directory should be searched first then save directory (true) or otherwise (false)',
default = 'false',
},
{
type = 'string',
name = 'version',
description = 't.version should be a string, representing the version of LÖVE for which your game was made. It should be formatted as "X.Y.Z" where X is the major release number, Y the minor, and Z the patch level. It allows LÖVE to display a warning if it isn\'t compatible. Its default is the version of LÖVE running.',
default = '"11.3"',
},
{
type = 'boolean',
name = 'console',
description = 'Determines whether a console should be opened alongside the game window (Windows only) or not. Note: On OSX you can get console output by running LÖVE through the terminal.',
default = 'false',
},
{
type = 'boolean',
name = 'accelerometerjoystick',
description = 'Sets whether the device accelerometer on iOS and Android should be exposed as a 3-axis Joystick. Disabling the accelerometer when it\'s not used may reduce CPU usage.',
default = 'true',
},
{
type = 'boolean',
name = 'externalstorage',
description = 'Sets whether files are saved in external storage (true) or internal storage (false) on Android.',
default = 'false',
},
{
type = 'boolean',
name = 'gammacorrect',
description = 'Determines whether gamma-correct rendering is enabled, when the system supports it.',
default = 'false',
},
{
type = 'table',
name = 'audio',
description = 'Audio options.',
table = {
{
type = 'boolean',
name = 'mic',
description = 'Request microphone permission from the user. When user allows it, love.audio.getRecordingDevices will lists recording devices available. Otherwise, love.audio.getRecordingDevices returns empty table and a message is shown to inform user when called.',
default = 'false',
},
{
type = 'boolean',
name = 'mixwithsystem',
description = 'Sets whether background audio / music from other apps should play while LÖVE is open. See love.system.hasBackgroundMusic for more details.',
default = 'true',
},
},
},
{
type = 'table',
name = 'window',
description = 'It is possible to defer window creation until love.window.setMode is first called in your code. To do so, set t.window = nil in love.conf (or t.screen = nil in older versions.) If this is done, LÖVE may crash if any function from love.graphics is called before the first love.window.setMode in your code.\n\nThe t.window table was named t.screen in versions prior to 0.9.0. The t.screen table doesn\'t exist in love.conf in 0.9.0, and the t.window table doesn\'t exist in love.conf in 0.8.0. This means love.conf will fail to execute (therefore it will fall back to default values) if care is not taken to use the correct table for the LÖVE version being used.',
table = {
{
type = 'string',
name = 'title',
description = 'Sets the title of the window the game is in. Alternatively love.window.setTitle can be used to change the window title outside of the config file.',
default = '"Untitled"',
},
{
type = 'string',
name = 'icon',
description = 'A filepath to an image to use as the window\'s icon. Not all operating systems support very large icon images. The icon can also be changed with love.window.setIcon.',
default = 'nil',
},
{
type = 'number',
name = 'width',
description = 'Sets the window\'s dimensions. If these flags are set to 0 LÖVE automatically uses the user\'s desktop dimensions.',
default = '800',
},
{
type = 'number',
name = 'height',
description = 'Sets the window\'s dimensions. If these flags are set to 0 LÖVE automatically uses the user\'s desktop dimensions.',
default = '600',
},
{
type = 'boolean',
name = 'borderless',
description = 'Removes all border visuals from the window. Note that the effects may wary between operating systems.',
default = 'false',
},
{
type = 'boolean',
name = 'resizable',
description = 'If set to true this allows the user to resize the game\'s window.',
default = 'false',
},
{
type = 'number',
name = 'minwidth',
description = 'Sets the minimum width and height for the game\'s window if it can be resized by the user. If you set lower values to window.width and window.height LÖVE will always favor the minimum dimensions set via window.minwidth and window.minheight.',
default = '1',
},
{
type = 'number',
name = 'minheight',
description = 'Sets the minimum width and height for the game\'s window if it can be resized by the user. If you set lower values to window.width and window.height LÖVE will always favor the minimum dimensions set via window.minwidth and window.minheight.',
default = '1',
},
{
type = 'boolean',
name = 'fullscreen',
description = 'Whether to run the game in fullscreen (true) or windowed (false) mode. The fullscreen can also be toggled via love.window.setFullscreen or love.window.setMode.',
default = 'false',
},
{
type = 'string',
name = 'fullscreentype',
description = 'Specifies the type of fullscreen mode to use (normal or desktop). Generally the desktop is recommended, as it is less restrictive than normal mode on some operating systems.',
default = '"desktop"',
},
{
type = 'boolean',
name = 'usedpiscale',
description = 'Sets whetever to enable or disable automatic DPI scaling.',
default = 'true',
},
{
type = 'number',
name = 'vsync',
description = 'Enables or deactivates vertical synchronization. Vsync tries to keep the game at a steady framerate and can prevent issues like screen tearing. It is recommended to keep vsync activated if you don\'t know about the possible implications of turning it off. Before LÖVE 11.0, this value was boolean (true or false). Since LÖVE 11.0, this value is number (1 to enable vsync, 0 to disable vsync, -1 to use adaptive vsync when supported).\n\nNote that in iOS, vertical synchronization is always enabled and cannot be changed.',
default = 'true',
},
{
type = 'number',
name = 'depth',
description = 'The number of bits per sample in the depth buffer (16/24/32, default nil)',
default = 'nil',
},
{
type = 'number',
name = 'stencil',
description = 'Then number of bits per sample in the depth buffer (generally 8, default nil)',
default = 'nil',
},
{
type = 'number',
name = 'msaa',
description = 'The number of samples to use with multi-sampled antialiasing.',
default = '0',
},
{
type = 'number',
name = 'display',
description = 'The index of the display to show the window in, if multiple monitors are available.',
default = '1',
},
{
type = 'boolean',
name = 'highdpi',
description = 'See love.window.getPixelScale, love.window.toPixels, and love.window.fromPixels. It is recommended to keep this option disabled if you can\'t test your game on a Mac or iOS system with a Retina display, because code will need tweaking to make sure things look correct.',
default = 'false',
},
{
type = 'number',
name = 'x',
description = 'Determines the position of the window on the user\'s screen. Alternatively love.window.setPosition can be used to change the position on the fly.',
default = 'nil',
},
{
type = 'number',
name = 'y',
description = 'Determines the position of the window on the user\'s screen. Alternatively love.window.setPosition can be used to change the position on the fly.',
default = 'nil',
},
},
},
{
type = 'table',
name = 'modules',
description = 'Module options.',
table = {
{
type = 'boolean',
name = 'audio',
description = 'Enable the audio module.',
default = 'true',
},
{
type = 'boolean',
name = 'event',
description = 'Enable the event module.',
default = 'true',
},
{
type = 'boolean',
name = 'graphics',
description = 'Enable the graphics module.',
default = 'true',
},
{
type = 'boolean',
name = 'image',
description = 'Enable the image module.',
default = 'true',
},
{
type = 'boolean',
name = 'joystick',
description = 'Enable the joystick module.',
default = 'true',
},
{
type = 'boolean',
name = 'keyboard',
description = 'Enable the keyboard module.',
default = 'true',
},
{
type = 'boolean',
name = 'math',
description = 'Enable the math module.',
default = 'true',
},
{
type = 'boolean',
name = 'mouse',
description = 'Enable the mouse module.',
default = 'true',
},
{
type = 'boolean',
name = 'physics',
description = 'Enable the physics module.',
default = 'true',
},
{
type = 'boolean',
name = 'sound',
description = 'Enable the sound module.',
default = 'true',
},
{
type = 'boolean',
name = 'system',
description = 'Enable the system module.',
default = 'true',
},
{
type = 'boolean',
name = 'timer',
description = 'Enable the timer module.',
default = 'true',
},
{
type = 'boolean',
name = 'touch',
description = 'Enable the touch module.',
default = 'true',
},
{
type = 'boolean',
name = 'video',
description = 'Enable the video module.',
default = 'true',
},
{
type = 'boolean',
name = 'window',
description = 'Enable the window module.',
default = 'true',
},
{
type = 'boolean',
name = 'thread',
description = 'Enable the thread module.',
default = 'true',
},
},
},
},
},
},
},
},
},
{
name = 'directorydropped',
description = 'Callback function triggered when a directory is dragged and dropped onto the window.',
variants = {
{
description = 'Paths passed into this callback are able to be used with love.filesystem.mount, which is the only way to get read access via love.filesystem to the dropped directory. love.filesystem.mount does not generally accept other full platform-dependent directory paths that haven\'t been dragged and dropped onto the window.',
arguments = {
{
type = 'string',
name = 'path',
description = 'The full platform-dependent path to the directory. It can be used as an argument to love.filesystem.mount, in order to gain read access to the directory with love.filesystem.',
},
},
},
},
},
{
name = 'displayrotated',
description = 'Called when the device display orientation changed, for example, user rotated their phone 180 degrees.',
variants = {
{
arguments = {
{
type = 'number',
name = 'index',
description = 'The index of the display that changed orientation.',
},
{
type = 'DisplayOrientation',
name = 'orientation',
description = 'The new orientation.',
},
},
},
},
},
{
name = 'draw',
description = 'Callback function used to draw on the screen every frame.',
variants = {
{
},
},
},
{
name = 'errorhandler',
description = 'The error handler, used to display error messages.',
variants = {
{
arguments = {
{
type = 'string',
name = 'msg',
description = 'The error message.',
},
},
returns = {
{
type = 'function',
name = 'mainLoop',
description = 'Function which handles one frame, including events and rendering, when called. If this is nil then LÖVE exits immediately.',
},
},
},
},
},
{
name = 'filedropped',
description = 'Callback function triggered when a file is dragged and dropped onto the window.',
variants = {
{
description = '',
arguments = {
{
type = 'DroppedFile',
name = 'file',
description = 'The unopened File object representing the file that was dropped.',
},
},
},
},
},
{
name = 'focus',
description = 'Callback function triggered when window receives or loses focus.',
variants = {
{
arguments = {
{
type = 'boolean',
name = 'focus',
description = 'True if the window gains focus, false if it loses focus. ',
},
},
},
},
},
{
name = 'gamepadaxis',
description = 'Called when a Joystick\'s virtual gamepad axis is moved.',
variants = {
{
arguments = {
{
type = 'Joystick',
name = 'joystick',
description = 'The joystick object.',
},
{
type = 'GamepadAxis',
name = 'axis',
description = 'The virtual gamepad axis.',
},
{
type = 'number',
name = 'value',
description = 'The new axis value.',
},
},
},
},
},
{
name = 'gamepadpressed',
description = 'Called when a Joystick\'s virtual gamepad button is pressed.',
variants = {
{
arguments = {
{
type = 'Joystick',
name = 'joystick',
description = 'The joystick object.',
},
{
type = 'GamepadButton',
name = 'button',
description = 'The virtual gamepad button.',
},
},
},
},
},
{
name = 'gamepadreleased',
description = 'Called when a Joystick\'s virtual gamepad button is released.',
variants = {
{
arguments = {
{
type = 'Joystick',
name = 'joystick',
description = 'The joystick object.',
},
{
type = 'GamepadButton',
name = 'button',
description = 'The virtual gamepad button.',
},
},
},
},
},
{
name = 'joystickadded',
description = 'Called when a Joystick is connected.',
variants = {
{
description = 'This callback is also triggered after love.load for every Joystick which was already connected when the game started up.',
arguments = {
{
type = 'Joystick',
name = 'joystick',
description = 'The newly connected Joystick object.',
},
},
},
},
},
{
name = 'joystickaxis',
description = 'Called when a joystick axis moves.',
variants = {
{
arguments = {
{
type = 'Joystick',
name = 'joystick',
description = 'The joystick object.',
},
{
type = 'number',
name = 'axis',
description = 'The axis number.',
},
{
type = 'number',
name = 'value',
description = 'The new axis value.',
},
},
},
},
},
{
name = 'joystickhat',
description = 'Called when a joystick hat direction changes.',
variants = {
{
arguments = {
{
type = 'Joystick',
name = 'joystick',
description = 'The joystick object.',
},
{
type = 'number',
name = 'hat',
description = 'The hat number.',
},
{
type = 'JoystickHat',
name = 'direction',
description = 'The new hat direction.',
},
},
},
},
},
{
name = 'joystickpressed',
description = 'Called when a joystick button is pressed.',
variants = {
{
arguments = {
{
type = 'Joystick',
name = 'joystick',
description = 'The joystick object.',
},
{
type = 'number',
name = 'button',
description = 'The button number.',
},
},
},
},
},
{
name = 'joystickreleased',
description = 'Called when a joystick button is released.',
variants = {
{
arguments = {
{
type = 'Joystick',
name = 'joystick',
description = 'The joystick object.',
},
{
type = 'number',
name = 'button',
description = 'The button number.',
},
},
},
},
},
{
name = 'joystickremoved',
description = 'Called when a Joystick is disconnected.',
variants = {
{
arguments = {
{
type = 'Joystick',
name = 'joystick',
description = 'The now-disconnected Joystick object.',
},
},
},
},
},
{
name = 'keypressed',
description = 'Callback function triggered when a key is pressed.',
variants = {
{
description = 'Scancodes are keyboard layout-independent, so the scancode \'w\' will be generated if the key in the same place as the \'w\' key on an American keyboard is pressed, no matter what the key is labelled or what the user\'s operating system settings are.\n\nKey repeat needs to be enabled with love.keyboard.setKeyRepeat for repeat keypress events to be received. This does not affect love.textinput.',
arguments = {
{
type = 'KeyConstant',
name = 'key',
description = 'Character of the pressed key.',
},
{
type = 'Scancode',
name = 'scancode',
description = 'The scancode representing the pressed key.',
},
{
type = 'boolean',
name = 'isrepeat',
description = 'Whether this keypress event is a repeat. The delay between key repeats depends on the user\'s system settings.',
},
},
},
{
description = 'Key repeat needs to be enabled with love.keyboard.setKeyRepeat for repeat keypress events to be received.',
arguments = {
{
type = 'KeyConstant',
name = 'key',
description = 'Character of the key pressed.',
},
{
type = 'boolean',
name = 'isrepeat',
description = 'Whether this keypress event is a repeat. The delay between key repeats depends on the user\'s system settings.',
},
},
},
},
},
{
name = 'keyreleased',
description = 'Callback function triggered when a keyboard key is released.',
variants = {
{
description = 'Scancodes are keyboard layout-independent, so the scancode \'w\' will be used if the key in the same place as the \'w\' key on an American keyboard is pressed, no matter what the key is labelled or what the user\'s operating system settings are.',
arguments = {
{
type = 'KeyConstant',
name = 'key',
description = 'Character of the released key.',
},
{
type = 'Scancode',
name = 'scancode',
description = 'The scancode representing the released key.',
},
},
},
},
},
{
name = 'load',
description = 'This function is called exactly once at the beginning of the game.',
variants = {
{
description = 'In LÖVE 11.0, the passed arguments excludes the game name and the fused command-line flag (if exist) when runs from non-fused LÖVE executable. Previous version pass the argument as-is without any filtering.',
arguments = {
{
type = 'table',
name = 'arg',
description = 'Command-line arguments given to the game.',
},
{
type = 'table',
name = 'unfilteredArg',
description = 'Unfiltered command-line arguments given to the executable (see #Notes).',
},
},
},
},
},
{
name = 'lowmemory',
description = 'Callback function triggered when the system is running out of memory on mobile devices.\n\nMobile operating systems may forcefully kill the game if it uses too much memory, so any non-critical resource should be removed if possible (by setting all variables referencing the resources to \'\'\'nil\'\'\'), when this event is triggered. Sounds and images in particular tend to use the most memory.',
variants = {
{
},
},
},
{
name = 'mousefocus',
description = 'Callback function triggered when window receives or loses mouse focus.',
variants = {
{
arguments = {
{
type = 'boolean',
name = 'focus',
description = 'Whether the window has mouse focus or not.',
},
},
},
},
},
{
name = 'mousemoved',
description = 'Callback function triggered when the mouse is moved.',
variants = {
{
description = 'If Relative Mode is enabled for the mouse, the \'\'\'dx\'\'\' and \'\'\'dy\'\'\' arguments of this callback will update but \'\'\'x\'\'\' and \'\'\'y\'\'\' are not guaranteed to.',
arguments = {
{
type = 'number',
name = 'x',
description = 'The mouse position on the x-axis.',
},
{
type = 'number',
name = 'y',
description = 'The mouse position on the y-axis.',
},
{
type = 'number',
name = 'dx',
description = 'The amount moved along the x-axis since the last time love.mousemoved was called.',
},
{
type = 'number',
name = 'dy',
description = 'The amount moved along the y-axis since the last time love.mousemoved was called.',
},
{
type = 'boolean',
name = 'istouch',
description = 'True if the mouse button press originated from a touchscreen touch-press.',
},
},
},
},
},
{
name = 'mousepressed',
description = 'Callback function triggered when a mouse button is pressed.',
variants = {
{
description = 'Use love.wheelmoved to detect mouse wheel motion. It will not register as a button press in version 0.10.0 and newer.',
arguments = {
{
type = 'number',
name = 'x',
description = 'Mouse x position, in pixels.',
},
{
type = 'number',
name = 'y',
description = 'Mouse y position, in pixels.',
},
{
type = 'number',
name = 'button',
description = 'The button index that was pressed. 1 is the primary mouse button, 2 is the secondary mouse button and 3 is the middle button. Further buttons are mouse dependent.',
},
{
type = 'boolean',
name = 'istouch',
description = 'True if the mouse button press originated from a touchscreen touch-press.',
},
{
type = 'number',
name = 'presses',
description = 'The number of presses in a short time frame and small area, used to simulate double, triple clicks',
},
},
},
},
},
{
name = 'mousereleased',
description = 'Callback function triggered when a mouse button is released.',
variants = {
{
arguments = {
{
type = 'number',
name = 'x',
description = 'Mouse x position, in pixels.',
},
{
type = 'number',
name = 'y',
description = 'Mouse y position, in pixels.',
},
{
type = 'number',
name = 'button',
description = 'The button index that was released. 1 is the primary mouse button, 2 is the secondary mouse button and 3 is the middle button. Further buttons are mouse dependent.',
},
{
type = 'boolean',
name = 'istouch',
description = 'True if the mouse button release originated from a touchscreen touch-release.',
},
{
type = 'number',
name = 'presses',
description = 'The number of presses in a short time frame and small area, used to simulate double, triple clicks',
},
},
},
},
},
{
name = 'quit',
description = 'Callback function triggered when the game is closed.',
variants = {
{
returns = {
{
type = 'boolean',
name = 'r',
description = 'Abort quitting. If true, do not close the game.',
},
},
},
},
},
{
name = 'resize',
description = 'Called when the window is resized, for example if the user resizes the window, or if love.window.setMode is called with an unsupported width or height in fullscreen and the window chooses the closest appropriate size.',
variants = {
{
description = 'Calls to love.window.setMode will \'\'\'only\'\'\' trigger this event if the width or height of the window after the call doesn\'t match the requested width and height. This can happen if a fullscreen mode is requested which doesn\'t match any supported mode, or if the fullscreen type is \'desktop\' and the requested width or height don\'t match the desktop resolution.\n\nSince 11.0, this function returns width and height in DPI-scaled units rather than pixels.',
arguments = {
{
type = 'number',
name = 'w',
description = 'The new width.',
},
{
type = 'number',
name = 'h',
description = 'The new height.',
},
},
},
},
},
{
name = 'run',
description = 'The main function, containing the main loop. A sensible default is used when left out.',
variants = {
{
returns = {
{
type = 'function',
name = 'mainLoop',
description = 'Function which handlers one frame, including events and rendering when called.',
},
},
},
},
},
{
name = 'textedited',
description = 'Called when the candidate text for an IME (Input Method Editor) has changed.\n\nThe candidate text is not the final text that the user will eventually choose. Use love.textinput for that.',
variants = {
{
description = '',
arguments = {
{
type = 'string',
name = 'text',
description = 'The UTF-8 encoded unicode candidate text.',
},
{
type = 'number',
name = 'start',
description = 'The start cursor of the selected candidate text.',
},
{
type = 'number',
name = 'length',
description = 'The length of the selected candidate text. May be 0.',
},
},
},
},
},
{
name = 'textinput',
description = 'Called when text has been entered by the user. For example if shift-2 is pressed on an American keyboard layout, the text \'@\' will be generated.',
variants = {
{
description = 'Although Lua strings can store UTF-8 encoded unicode text just fine, many functions in Lua\'s string library will not treat the text as you might expect. For example, #text (and string.len(text)) will give the number of \'\'bytes\'\' in the string, rather than the number of unicode characters. The Lua wiki and a presentation by one of Lua\'s creators give more in-depth explanations, with some tips.\n\nThe utf8 library can be used to operate on UTF-8 encoded unicode text (such as the text argument given in this function.)\n\nOn Android and iOS, textinput is disabled by default; call love.keyboard.setTextInput to enable it.',
arguments = {
{
type = 'string',