forked from twolivesleft/Codea-Documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Lua.yaml
1167 lines (1081 loc) · 35.2 KB
/
Lua.yaml
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
id: lua
name: Lua
subtitle: Tables, Strings, Math and Time
ordering:
- Overview
- Language
- Tables
- Strings
- Math
- Date and Time
functions:
#---------------------------------
# For Loops Overview
#---------------------------------
- category: overview
description: |
You can use **for loops** in Lua to iterate over arrays and tables, performing tasks for each element.
This example simply iterates i over the values 1 to 10
-- Iterate from 1 to 10
for i = 1, 10 do
print( i )
end
This example uses the `ipairs` function to sequentially iterate over a table. Note that ipairs only works on tables that have sequential elements beginning at 1.
-- Iterate over an array named 'arr'
arr = { 3, 2, 1 }
for i,v in ipairs(arr) do
print( "arr["..i.."] = "..v )
end
-- Prints:
-- arr[1] = 3
-- arr[2] = 2
-- arr[3] = 1
This example uses `pairs` to iterate over all the key/value pairs in a table, unlike `ipairs` the keys do not have to be integral values, and can be anything.
-- Iterate over a table named 'tab'
tab = { x = 3, y = "string", z = 1 }
for key,value in pairs(tab) do
print( "tab."..key.." = "..value )
end
-- Prints:
-- tab.y = string
-- tab.x = 3
-- tab.z = 1
group: Overview
id: forloops
name: For Loops Overview
related:
- ipairs
- pairs
#---------------------------------
#---------------------------------
# Conditionals Overview
#---------------------------------
- category: overview
description: |
Use **conditionals** to test for a particular circumstance and then branch your code appropriately. See the examples below.
-- Check if x is equal to 10
if x == 10 then
print( "x equals 10" )
end
-- else and elseif
if x == 10 then
print( "x is 10" )
elseif x == 5 then
print( "x is 5" )
else
print( "x is something else: "..x )
end
-- Checking multiple values
if x == 10 and y < 5 then
print( "x is 10 and y is less than 5" )
elseif x == 5 or y == 3 then
print( "x is 5 or y is 3" )
else
print( "x is "..x.." and y is "..y )
end
group: Overview
id: conditionals
name: Conditionals Overview
#---------------------------------
#---------------------------------
# ipairs()
#---------------------------------
- category: function
description: >
`ipairs` can be used to iterate over a table sequentially,
starting from the index 1 and continuing until the first integer key absent
from the tableReturns three values: an iterator function, the table,
and 0.
group: Language
id: ipairs
name: ipairs( table )
parameters:
- description: table to iterate over
name: table
related:
- forloops
- pairs
returns: >
Returns three values: an iterator function, the table, and 0'
syntax: |
for i,v in ipairs( t ) do body end
-- This will iterate over the pairs:
-- (1,t[1]), (2,t[2]), ...
#---------------------------------
#---------------------------------
# pairs()
#---------------------------------
- category: function
description: >
`pairs` can be used to iterate over a tables key-value
pairs. Returns three values: the next function, the table t, and nil.
group: Language
id: pairs
name: pairs( table )
parameters:
- description: table to iterate over
name: table
related:
- forloops
- ipairs
returns: >
Returns three values: the next function, the table t, and nil
syntax: |
for k,v in pairs( t ) do body end
-- This will iterate over all key-value
-- pairs in table t
#---------------------------------
#---------------------------------
# table.concat
#---------------------------------
- category: function
description: >
Given an array where all elements are strings or numbers, returns `table[i]..sep..table[i+1] ... sep..table[j]`. The default value for `sep` is the empty string, the default for `i` is 1, and the default for `j` is the length of the table. If `i` is greater than `j`, returns the empty string.
group: Tables
id: table.concat
name: table.concat( table, sep )
parameters:
- description: table to concatenate
name: table
- description: separator string
name: sep
- description: int, starting index to concatenate from
name: i
- description: int, ending index
name: j
returns: A string of the elements in `table` concatenated with each other,
separated by `sep`
syntax: |
table.concat( table )
table.concat( table, sep )
table.concat( table, sep, i )
table.concat( table, sep, i, j )
#---------------------------------
#---------------------------------
# table.insert
#---------------------------------
- category: function
description: Inserts element `value` at position `pos` in `table`,
shifting up other elements to open space, if necessary. The default value for
`pos` is n+1, where n is the length of the table, so that a call `table.insert(t,x)`
inserts x at the end of table t.
group: Tables
id: table.insert
name: table.insert( table, pos, value )
parameters:
- description: table to insert into
name: table
- description: int, position to inset
name: pos
- description: value to insert
name: value
related:
- table.remove
syntax: |
table.insert( table, value )
table.insert( table, pos, value )
#---------------------------------
#---------------------------------
# table.maxn
#---------------------------------
- category: function
description: Returns the largest positive numerical index of the given table,
or zero if the table has no positive numerical indices. (To do its job this
function does a linear traversal of the whole table.)
group: Tables
id: table.maxn
name: table.maxn( table )
parameters:
- description: table to query
name: table
returns: Largest positive numerical index of the given table
syntax: table.maxn( table )
#---------------------------------
#---------------------------------
# table.remove
#---------------------------------
- category: function
description: Removes from `table` the element at position `pos`,
shifting down other elements to close the space, if necessary. Returns the value
of the removed element. The default value for `pos` is n, where n is the
length of the table, so that a call `table.remove(t)` removes the last
element of table t.
group: Tables
id: table.remove
name: table.remove( table, pos )
parameters:
- description: table to insert into
name: table
- description: int, position of value to remove
name: pos
related:
- table.insert
returns: Value of the removed element
syntax: |
table.remove( table )
table.remove( table, pos )
#---------------------------------
#---------------------------------
# table.sort
#---------------------------------
- category: function
description: >
Sorts table elements in a given order, in-place, from `table[1]`
to `table[n]`, where n is the length of the table. If `comp` is given,
then it must be a function that receives two table elements and returns true
when the first is less than the second (so that `not comp(a[i+1],a[i]`)
will be true after the sort). If `comp` is not given, then the standard
Lua operator < is used instead.
The sort algorithm is not stable;
that is, elements considered equal by the given order may have their relative
positions changed by the sort.
group: Tables
id: table.sort
name: table.sort( table )
parameters:
- description: the table to sort
name: table
- description: a function that receives two table elements and returns true when
the first is less than the second
name: comp
syntax: |
table.sort( table )
table.sort( table, comp )
#---------------------------------
#---------------------------------
# os.clock
#---------------------------------
- category: function
description: Returns an approximation of the amount in seconds of CPU time
used by the program.
group: Date and Time
id: os.clock
name: os.clock()
returns: Approximation of the amount in seconds of CPU time used by the program.
syntax: os.clock()
#---------------------------------
#---------------------------------
# os.difftime
#---------------------------------
- category: function
description: Returns the number of seconds from time `t1` to time `t2`.
In POSIX, Windows, and some other systems, this value is exactly `t2-t1`.
group: Date and Time
id: os.difftime
name: os.difftime( t2, t1 )
parameters:
- description: Ending time
name: t2
- description: Starting time
name: t1
related:
- os.time
returns: Number of seconds from time `t1` to time `t2`.
syntax: os.difftime( t2, t1 )
#---------------------------------
#---------------------------------
# os.date
#---------------------------------
- category: function
description: >
Returns a string or a table containing the date and time, formatted
according to the given string `format`.
If the `time` argument
is present, this is the time to be formatted (see the `os.time` function
for a description of this value). Otherwise, `date` formats the current
time.
If format starts with '!', then the date is formatted in
Coordinated Universal Time. After this optional character, if format is the
string '*t', then date returns a table with the following fields: year (four
digits), month (1--12), day (1--31), hour (0--23), min (0--59), sec (0--61),
wday (weekday, Sunday is 1), yday (day of the year), and isdst (daylight saving
flag, a boolean).
If `format` is not '*t', then `date`
returns the date as a string, formatted according to the same rules as the C
function `strftime`.
When called without arguments, date returns
a reasonable date and time representation that depends on the host system and
on the current locale (that is, `os.date()` is equivalent to `os.date('%c')`).
group: Date and Time
id: os.date
name: os.date( format )
parameters:
- description: String used to format the returned date
name: format
- description: If the time argument is present, this is the time to be formatted
(see the os.time function for a description of this value).
name: time
related:
- os.time
- os.setlocale
returns: A string or a table containing the date and time.
syntax: |
os.date()
os.date( format )
os.date( format, time )
#---------------------------------
#---------------------------------
# os.setlocale
#---------------------------------
- category: function
description: >
Sets the current locale of the program. `locale` is a string
specifying a locale; `category` is an optional string describing which
category to change: "all", "collate", "ctype", "monetary", "numeric", or "time";
the default category is "all". The function returns the name of the new locale,
or nil if the request cannot be honored.
If `locale` is the
empty string, the current locale is set to an implementation-defined native
locale. If `locale` is the string "C", the current locale is set to the
standard C locale.
When called with `nil` as the first argument,
this function only returns the name of the current locale for the given category.
group: Date and Time
id: os.setlocale
name: os.setlocale( locale )
parameters:
- description: String specifying a locale, can be nil or the empty string.
name: locale
- description: String specifying a category to set, can be "all", "collate", "ctype",
"monetary", "numeric", or "time"
name: category
related:
- os.date
- os.time
returns: When called with `nil` for the first argument, returns the name
of the current locale for the given category.
syntax: |
os.setlocale( locale )
os.setlocale( locale, category )
#---------------------------------
#---------------------------------
# os.time
#---------------------------------
- category: function
description: >
Returns the current time when called without arguments, or a time
representing the date and time specified by the given table. This table must
have fields `year`, `month`, and `day`, and may have fields `hour`,
`min`, `sec`, and `isdst` (for a description of these fields,
see the os.date function).
The returned value is a number, whose
meaning depends on your system. In POSIX, Windows, and some other systems, this
number counts the number of seconds since some given start time (the "epoch").
In other systems, the meaning is not specified, and the number returned by `time`
can be used only as an argument to `date` and `difftime`.
group: Date and Time
id: os.time
name: os.time()
parameters:
- description: This table must have fields `year`, `month`, and `day`,
and may have fields `hour`, `min`, `sec`, and `isdst`
name: table
related:
- os.date
- os.setlocale
- os.difftime
returns: A number, whose meaning depends on your system. In POSIX, Windows, and
some other systems, this number counts the number of seconds since some given
start time (the "epoch"). In other systems, the meaning is not specified, and
the number returned by `time` can be used only as an argument to `date`
and `difftime`.
syntax: |
os.time()
os.time( table )
#---------------------------------
#---------------------------------
# string.find
#---------------------------------
- category: function
description: >
Looks for the first match of `pattern` in the string `s`.
If it finds a match, then `string.find()` returns the indices of `s`
where the occurrence starts and ends; otherwise, it returns `nil`. A third,
optional numerical argument `init` specifies where to start the search,
its default value is 1 and can be negative. A value of `true` as the fourth
optional argument `plain` turns off the pattern matching facilities so
the function performs a plain "find substring" operation, with no characters
in `pattern` being considered "magic." Note that if `plain` is given,
then `init` must be given as well.
If the pattern has captures,
then in a successful match the captured values are also returned, after the
two indices.
group: Strings
id: string.find
name: string.find( s, pattern )
parameters:
- description: string to search in
name: s
- description: pattern to look for
name: pattern
- description: starting character in string to search from, default is 1
name: init
- description: boolean, perform a plain substring search
name: plain
returns: The start and end indices of the match, or `nil` if no match. If
the pattern has captures then captured values are also returned after the indices
syntax: |
string.find( s, pattern )
string.find( s, pattern, init )
string.find( s, pattern, init, plain )
#---------------------------------
#---------------------------------
# string.format
#---------------------------------
- category: function
description: Returns a formatted version of its variable arguments following
the description given in the first argument, which must be a string. The format
string follows the same rules as the `printf` family of standard C functions.
The only difference are that the options/modifiers `*, 1, L, n, p` and
`h` are not supported and that there is an extra option `q`. The `q`
option formats a string in a form suitable to be safely read back by the Lua
interpreter, for example all double quotes, newlines, embedded zeros and backslashes
will be escaped when written.
examples:
- example: |
s = string.format("Number is %d", 5)
print( s )
-- prints "Number is 5"
group: Strings
id: string.format
name: string.format( formatstring, ... )
parameters:
- description: string defining the format
name: formatstring
returns: A formatted string
syntax: string.format( formatstring, ... )
#---------------------------------
#---------------------------------
# string.len
#---------------------------------
- category: function
description: Receives a string and returns its length. The empty string ""
has length 0.
group: Strings
id: string.len
name: string.len( s )
parameters:
- description: get the length of this string
name: s
returns: Length of string `s`
syntax: string.len( s )
#---------------------------------
#---------------------------------
# string.lower
#---------------------------------
- category: function
description: Receives a string and returns a copy of this string with all uppercase
letters changed to lowercase. All other characters are left unchanged.
group: Strings
id: string.lower
name: string.lower( s )
parameters:
- description: get a lowercase version of this string
name: s
related:
- string.upper
returns: Lowercase version of string `s`
syntax: string.lower( s )
#---------------------------------
#---------------------------------
# string.upper
#---------------------------------
- category: function
description: Receives a string and returns a copy of this string with all lowercase
letters changed to uppercase. All other characters are left unchanged.
group: Strings
id: string.upper
name: string.upper( s )
parameters:
- description: get an uppercase version of this string
name: s
related:
- string.lower
returns: Uppercase version of string `s`
syntax: string.upper( s )
#---------------------------------
#---------------------------------
# string.match
#---------------------------------
- category: function
description: Looks for the first match of `pattern` in the string `s`.
If it finds one then `string.match()` returns the captures from the pattern,
otherwise it returns `nil`. If `pattern` specifies no captures, then
the whole match is returned. A third optional numerical argument `init`
specifies where to start the search. Its default is 1 and can be negative.
group: Strings
id: string.match
name: string.match( s, pattern )
parameters:
- description: string to search
name: s
- description: pattern to match
name: pattern
- description: starting location in string
name: init
related:
- string.find
returns: Captures from the first match of `pattern` in string `s`, or
`nil` if none were found
syntax: |
string.match( s, pattern )
string.match( s, pattern, init )
#---------------------------------
#---------------------------------
# string.rep
#---------------------------------
- category: function
description: Returns a string that is the concatenation of `n` copies
of the string `s`.
group: Strings
id: string.rep
name: string.rep( s, n )
parameters:
- description: string to replicate
name: s
- description: int, number of times to replicate the string
name: n
returns: >
`n` concatenations of string `s`
syntax: string.rep( s, n )
#---------------------------------
#---------------------------------
# string.sub
#---------------------------------
- category: function
description: Returns the substring of `s` that starts at `i` and
continues until `j`; `i` and `j` can be negative. If `j`
is absent, then it is assumed to be equal to -1 (which is the same as the string
length). In particular, the call `string.sub(s,1,j)` returns a prefix of
`s` with length `j`, and string.sub(s, -i) returns a suffix of `s`
with length `i`.
group: Strings
id: string.sub
name: string.sub( s, i, j )
parameters:
- description: find substring of this string
name: s
- description: int, starting index
name: i
- description: int, ending index
name: j
returns: Substring of string `s`
syntax: |
string.sub( s, i )
string.sub( s, i, j )
#---------------------------------
#---------------------------------
# math.abs
#---------------------------------
- category: function
description: This function returns the absolute value of `value`. For example,
`math.abs(-5)` returns 5.
group: Math
id: math.abs
name: math.abs( value )
parameters:
- description: int or float, the number to get the absolute value of
name: value
returns: The absolute value of value
syntax: math.abs( value )
#---------------------------------
#---------------------------------
# math.acos
#---------------------------------
- category: function
description: This function returns the arc cosine of `value` in radians
group: Math
id: math.acos
name: math.acos( value )
parameters:
- description: int or float, compute the arc cosine of this number
name: value
related:
- math.asin
- math.atan
- math.atan2
returns: The arc cosine of value in radians
syntax: math.acos( value )
#---------------------------------
#---------------------------------
# math.asin
#---------------------------------
- category: function
description: This function returns the arc sine of `value` in radians
group: Math
id: math.asin
name: math.asin( value )
parameters:
- description: int or float, compute the arc sine of this number
name: value
related:
- math.acos
- math.atan
- math.atan2
returns: The arc sine of value in radians
syntax: math.asin( value )
#---------------------------------
#---------------------------------
# math.atan
#---------------------------------
- category: function
description: This function returns the arc tangent of `value` in radians
group: Math
id: math.atan
name: math.atan( value )
parameters:
- description: int or float, compute the arc tangent of this number
name: value
related:
- math.asin
- math.acos
- math.atan2
returns: The arc tangent of value in radians
syntax: math.atan( value )
#---------------------------------
#---------------------------------
# math.atan2
#---------------------------------
- category: function
description: This function returns the arc tangent of y/x in radians, but uses
the sign of both parameters to find the quadrant of the result. It also handles
correctly the case of x being zero.
group: Math
id: math.atan2
name: math.atan2( y, x )
parameters:
- description: int or float, denominator for arc tangent
name: x
- description: int or float, numerator for arc tangent
name: y
related:
- math.asin
- math.acos
- math.atan
returns: The arc tangent of y/x in radians
syntax: math.atan2( y, x )
#---------------------------------
#---------------------------------
# math.ceil
#---------------------------------
- category: function
description: This function returns the smallest integer larger than or equal to
`value`. This rounds a number up to the nearest integer. For example, `math.ceil(5.2)`
returns 6.
group: Math
id: math.ceil
name: math.ceil( value )
parameters:
- description: int or float, compute the smallest integer larger than or equal
to this number
name: value
related:
- math.floor
returns: The smallest integer larger than or equal to value
syntax: math.ceil( value )
#---------------------------------
#---------------------------------
# math.cos
#---------------------------------
- category: function
description: This function returns the cosine of `value` (assumed to be in radians).
group: Math
id: math.cos
name: math.cos( value )
parameters:
- description: int or float, compute the cosine of this number
name: value
related:
- math.sin
- math.tan
returns: Cosine of value
syntax: math.cos( value )
#---------------------------------
#---------------------------------
# math.cosh
#---------------------------------
- category: function
description: This function returns hyperbolic cosine of `value`.
group: Math
id: math.cosh
name: math.cosh( value )
parameters:
- description: int or float, compute the hyperbolic cosine of this number
name: value
related:
- math.sinh
- math.tanh
returns: Hyperbolic cosine of value
syntax: math.cosh( value )
#---------------------------------
#---------------------------------
# math.deg
#---------------------------------
- category: function
description: This function returns the angle specified by `value` (given
in radians) in degrees.
group: Math
id: math.deg
name: math.deg( value )
parameters:
- description: int or float, angle in radians to convert to degrees
name: value
related:
- math.rad
returns: Angle specified by value (in radians) in degrees
syntax: math.deg( value )
#---------------------------------
#---------------------------------
# math.rad
#---------------------------------
- category: function
description: This function returns the angle specified by `value` (given
in degrees) in radians.
group: Math
id: math.rad
name: math.rad( value )
parameters:
- description: int or float, angle in degrees to convert to radians
name: value
related:
- math.deg
returns: Angle specified by value (in degrees) in radians
syntax: math.rad( value )
#---------------------------------
#---------------------------------
# math.exp
#---------------------------------
- category: function
description: This function returns **e** raised to `value`
group: Math
id: math.exp
name: math.exp( value )
parameters:
- description: int or float, exponent of e
name: value
returns: e raised to the power of value
syntax: math.exp( value )
#---------------------------------
#---------------------------------
# math.floor
#---------------------------------
- category: function
description: This function returns the largest integer smaller than or equal to
`value`. This rounds a number down to the nearest integer. For example, `math.floorTh(5.7)`
returns 5.
group: Math
id: math.floor
name: math.floor( value )
parameters:
- description: int or float, compute the largest integer smaller than or equal
to this number
name: value
related:
- math.ceil
returns: The largest integer smaller than or equal to value
syntax: math.floor( value )
#---------------------------------
#---------------------------------
# math.fmod
#---------------------------------
- category: function
description: This function returns the remainder of the division of `x` by `y` that
rounds the quotient towards zero.
group: Math
id: math.fmod
name: math.fmod( x, y )
parameters:
- description: int or float
name: x
- description: int or float
name: y
related:
- math.modf
returns: The remainder of the division of x by y
syntax: math.fmod( x, y )
#---------------------------------
#---------------------------------
# math.frexp
#---------------------------------
- category: function
description: This function returns m and e such that `value` = m2^e, e is an integer
and the absolute value of m is in the range [0.5, 1) (or zero when x is zero).
group: Math
id: math.frexp
name: math.frexp( value )
parameters:
- description: int or float
name: value
related:
- math.ldexp
returns: m and e such that value = m2^e, e is an integer and the absolute value
of m is in the range [0.5, 1) (or zero when x is zero).
syntax: math.frexp( value )
#---------------------------------
#---------------------------------
# math.ldexp
#---------------------------------
- category: function
description: This function returns m2^e (e should be an integer)
group: Math
id: math.ldexp
name: math.ldexp( m, e )
parameters:
- description: int or float
name: m
- description: int
name: e
related:
- math.frexp
returns: m2^e
syntax: math.ldexp( m, e )
#---------------------------------
#---------------------------------
# math.log
#---------------------------------
- category: function
description: This function returns the natural logarithm of `value`
group: Math
id: math.log
name: math.log( value )
parameters:
- description: int or float, compute the natural logarithm of this value
name: value
related:
- math.log10
returns: The natural logarithm of value
syntax: math.log( value )
#---------------------------------
#---------------------------------
# math.log10
#---------------------------------
- category: function
description: This function returns the base-10 logarithm of `value`
group: Math
id: math.log10
name: math.log10( value )
parameters:
- description: int or float, compute the base-10 logarithm of this value
name: value
related:
- math.log
returns: The base-10 logarithm of value
syntax: math.log10( value )
#---------------------------------
#---------------------------------
# math.max
#---------------------------------
- category: function
description: This function returns maximum value among its arguments.
group: Math
id: math.max
name: math.max( value, ... )
parameters:
- description: any comparable value
name: value
related:
- math.min
returns: The maximum value among its arguments
syntax: math.max( value, ... )
#---------------------------------
#---------------------------------
# math.min
#---------------------------------
- category: function
description: This function returns minimum value among its arguments.
group: Math
id: math.min
name: math.min( value, ... )
parameters:
- description: any comparable value
name: value
related:
- math.max
returns: The minimum value among its arguments
syntax: math.min( value, ... )
#---------------------------------
#---------------------------------
# math.modf
#---------------------------------
- category: function
description: This function returns two numbers, the integral part of `value` and
the fractional part of `value`.
group: Math
id: math.modf
name: math.modf( value )
parameters:
- description: int or float
name: value
related:
- math.fmod
returns: Two numbers, the integral part of value and the fractional part of value
syntax: math.modf( value )
#---------------------------------
#---------------------------------
# math.pow
#---------------------------------
- category: function
description: This function returns `x` raised to `y`. Equivalent to the expression
x^y.
group: Math
id: math.pow
name: math.pow( x, y )
parameters:
- description: int or float