File: lua.bflang2

package info (click to toggle)
bluefish 2.2.6-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 28,096 kB
  • ctags: 5,830
  • sloc: xml: 150,791; ansic: 59,107; sh: 11,453; python: 6,337; makefile: 1,034; sed: 16
file content (3300 lines) | stat: -rw-r--r-- 131,183 bytes parent folder | download | duplicates (5)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
<?xml version="1.0"?>
<!--
		Bluefish HTML Editor
		lua.bflang2 $Revision: 7425 $
 
		Copyright (C) 2008-2011 Olivier Sessink
		
	    This program is free software: you can redistribute it and/or modify
		it under the terms of the GNU General Public License as published by
		the Free Software Foundation, either version 3 of the License, or
		(at your option) any later version.
		
		This program is distributed in the hope that it will be useful,
		but WITHOUT ANY WARRANTY; without even the implied warranty of
		MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
		GNU General Public License for more details.
		
		You should have received a copy of the GNU General Public License
		along with this program.  If not, see <http://www.gnu.org/licenses/>.		
-->
<!--
		References from Lua 5.1 Reference Manual <http://www.lua.org/manual/5.1/>
		Copyright © 1994–2011 Lua.org, PUC-Rio under the terms of the MIT license.
-->
<bflang name="Lua" version="2.0" table="1636" contexts="11" matches="329">
<header>
	<mime type="text/x-lua?lua"/>
	<option name="load_reference" default="1"/>
	<option name="load_completion" default="1"/>
	<option name="show_in_menu" default="1"/>
	<option name="Parentheses block_foldable" default="0" description="Allow folding of Parentheses block"/>
	<highlight name="keyword" style="keyword" />
	<highlight name="brackets" style="brackets" />
	<highlight name="type" style="type" />
	<highlight name="comment" style="comment" />
	<highlight name="string" style="string" />
	<highlight name="value" style="value" />
	<highlight name="preprocessor" style="preprocessor" />
	<highlight name="function" style="function" />
</header>
<properties>
	<comment id="cm.blockcomment" type="block" start="--[[" end="]]" />
	<comment id="cm.linecomment" type="line" start="-- " />
	<smartindent characters="{" />
	<smartoutdent characters="}" />
</properties>
<definition>
<context symbols=" ;(){}[]:\&#34;\\',*&amp;^%!+=-|/?#&#9;&#10;&#13;" commentid_block="cm.blockcomment" commentid_line="cm.linecomment">
<group highlight="keyword" >
	<autocomplete enable="1" />
<element pattern="and" />
<element pattern="break" />
<element pattern="do" />
<element pattern="else" />
<element pattern="elseif" />
<element pattern="end" />
<element pattern="false" />
<element pattern="for" />
<element pattern="function" />
<element pattern="if" />
<element pattern="in" />
<element pattern="local" />
<element pattern="nil" />
<element pattern="not" />
<element pattern="or" />
<element pattern="repeat" />
<element pattern="return" />
<element pattern="then" />
<element pattern="true" />
<element pattern="until" />
<element pattern="while" />
</group>
<group highlight="function" >
	<autocomplete append="()" backup_cursor="1" />
<element pattern="lua_atpanic">
<reference><span color="blue" stretch="ultracondensed">[-0, +0, <i>-</i>]</span>
<i>lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);</i>
Sets a new panic function and returns the old one.
If an error happens outside any protected environment,
Lua calls a <i>panic function</i>
and then calls <b>exit(EXIT_FAILURE)</b>,
thus exiting the host application.
Your panic function can avoid this exit by
never returning (e.g., doing a long jump).
The panic function can access the error message at the top of the stack.
</reference>
</element>
<element pattern="lua_call">
<reference><span color="blue">[-(nargs + 1), +nresults, <i>e</i>]</span>
<i>void lua_call (lua_State *L, int nargs, int nresults);</i>
Calls a function.
To call a function you must use the following protocol:
first, the function to be called is pushed onto the stack;
then, the arguments to the function are pushed
in direct order;
that is, the first argument is pushed first.
Finally you call <b>lua_call</b>;
<b>nargs</b> is the number of arguments that you pushed onto the stack.
All arguments and the function value are popped from the stack
when the function is called.
The function results are pushed onto the stack when the function returns.
The number of results is adjusted to <b>nresults</b>,
unless <b>nresults</b> is <b>LUA_MULTRET</b>.
In this case, <i>all</i> results from the function are pushed.
Lua takes care that the returned values fit into the stack space.
The function results are pushed onto the stack in direct order
(the first result is pushed first),
so that after the call the last result is on the top of the stack.
Any error inside the called function is propagated upwards
(with a <b>longjmp</b>).
</reference>
</element>
<element pattern="lua_checkstack">
<reference><span color="blue">[-0, +0, <i>m</i>]</span>
<i>int lua_checkstack (lua_State *L, int extra);</i>
Ensures that there are at least <b>extra</b> free stack slots in the stack.
It returns false if it cannot grow the stack to that size.
This function never shrinks the stack;
if the stack is already larger than the new size,
it is left unchanged.
</reference>
</element>
<element pattern="lua_close">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>void lua_close (lua_State *L);</i>
Destroys all objects in the given Lua state
(calling the corresponding garbage-collection metamethods, if any)
and frees all dynamic memory used by this state.
On several platforms, you may not need to call this function,
because all resources are naturally released when the host program ends.
On the other hand, long-running programs,
such as a daemon or a web server,
might need to release states as soon as they are not needed,
to avoid growing too large.
</reference>
</element>
<element pattern="lua_concat">
<reference><span color="blue">[-n, +1, <i>e</i>]</span>
<i>void lua_concat (lua_State *L, int n);</i>
Concatenates the <b>n</b> values at the top of the stack,
pops them, and leaves the result at the top.
If <b>n</b> is 1, the result is the single value on the stack
(that is, the function does nothing);
if <b>n</b> is 0, the result is the empty string.
Concatenation is performed following the usual semantics of Lua
(see §2.5.4).
</reference>
</element>
<element pattern="lua_cpcall">
<reference><span color="blue">[-0, +(0|1), <i>-</i>]</span>
<i>int lua_cpcall (lua_State *L, lua_CFunction func, void *ud);</i>
Calls the C function <b>func</b> in protected mode.
<b>func</b> starts with only one element in its stack,
a light userdata containing <b>ud</b>.
In case of errors,
<b>lua_cpcall</b> returns the same error codes as <b>lua_pcall</b>,
plus the error object on the top of the stack;
otherwise, it returns zero, and does not change the stack.
All values returned by <b>func</b> are discarded.
</reference>
</element>
<element pattern="lua_createtable">
<reference><span color="blue">[-0, +1, <i>m</i>]</span>
<i>void lua_createtable (lua_State *L, int narr, int nrec);</i>
Creates a new empty table and pushes it onto the stack.
The new table has space pre-allocated
for <b>narr</b> array elements and <b>nrec</b> non-array elements.
This pre-allocation is useful when you know exactly how many elements
the table will have.
Otherwise you can use the function <b>lua_newtable</b>.
</reference>
</element>
<element pattern="lua_dump">
<reference><span color="blue">[-0, +0, <i>m</i>]</span>
<i>int lua_dump (lua_State *L, lua_Writer writer, void *data);</i>
Dumps a function as a binary chunk.
Receives a Lua function on the top of the stack
and produces a binary chunk that,
if loaded again,
results in a function equivalent to the one dumped.
As it produces parts of the chunk,
<b>lua_dump</b> calls function <b>writer</b> (see <b>lua_Writer</b>)
with the given <b>data</b>
to write them.
The value returned is the error code returned by the last
call to the writer;
0 means no errors.
This function does not pop the Lua function from the stack.
</reference>
</element>
<element pattern="lua_equal">
<reference><span color="blue">[-0, +0, <i>e</i>]</span>
<i>int lua_equal (lua_State *L, int index1, int index2);</i>
Returns 1 if the two values in acceptable indices <b>index1</b> and
<b>index2</b> are equal,
following the semantics of the Lua <b>==</b> operator
(that is, may call metamethods).
Otherwise returns 0.
Also returns 0 if any of the indices is non valid.
</reference>
</element>
<element pattern="lua_error">
<reference><span color="blue">[-1, +0, <i>v</i>]</span>
<i>int lua_error (lua_State *L);</i>
Generates a Lua error.
The error message (which can actually be a Lua value of any type)
must be on the stack top.
This function does a long jump,
and therefore never returns.
(see <b>luaL_error</b>).
</reference>
</element>
<element pattern="lua_gc">
<reference><span color="blue">[-0, +0, <i>e</i>]</span>
<i>int lua_gc (lua_State *L, int what, int data);</i>
Controls the garbage collector.
This function performs several tasks,
according to the value of the parameter <b>what</b>:
<b>LUA_GCSTOP</b>:
stops the garbage collector.
<b>LUA_GCRESTART</b>:
restarts the garbage collector.
<b>LUA_GCCOLLECT</b>:
performs a full garbage-collection cycle.
<b>LUA_GCCOUNT</b>:
returns the current amount of memory (in Kbytes) in use by Lua.
<b>LUA_GCCOUNTB</b>:
returns the remainder of dividing the current amount of bytes of
memory in use by Lua by 1024.
<b>LUA_GCSTEP</b>:
performs an incremental step of garbage collection.
The step "size" is controlled by <b>data</b>
(larger values mean more steps) in a non-specified way.
If you want to control the step size
you must experimentally tune the value of <b>data</b>.
The function returns 1 if the step finished a
garbage-collection cycle.
<b>LUA_GCSETPAUSE</b>:
sets <b>data</b> as the new value
for the <i>pause</i> of the collector (see §2.10).
The function returns the previous value of the pause.
<b>LUA_GCSETSTEPMUL</b>:
sets <b>data</b> as the new value for the <i>step multiplier</i> of
the collector (see §2.10).
The function returns the previous value of the step multiplier.
</reference>
</element>
<element pattern="lua_getallocf">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>lua_Alloc lua_getallocf (lua_State *L, void **ud);</i>
Returns the memory-allocation function of a given state.
If <b>ud</b> is not <b>NULL</b>, Lua stores in <b>*ud</b> the
opaque pointer passed to <b>lua_newstate</b>.
</reference>
</element>
<element pattern="lua_getfenv">
<reference><span color="blue">[-0, +1, <i>-</i>]</span>
<i>void lua_getfenv (lua_State *L, int index);</i>
Pushes onto the stack the environment table of
the value at the given index.
</reference>
</element>
<element pattern="lua_getfield">
<reference><span color="blue">[-0, +1, <i>e</i>]</span>
<i>void lua_getfield (lua_State *L, int index, const char *k);</i>
Pushes onto the stack the value <b>t[k]</b>,
where <b>t</b> is the value at the given valid index.
As in Lua, this function may trigger a metamethod
for the "index" event (see §2.8).
</reference>
</element>
<element pattern="lua_getglobal">
<reference><span color="blue">[-0, +1, <i>e</i>]</span>
<i>void lua_getglobal (lua_State *L, const char *name);</i>
Pushes onto the stack the value of the global <b>name</b>.
It is defined as a macro:
<i>     #define lua_getglobal(L,s)  lua_getfield(L, LUA_GLOBALSINDEX, s)
</i>
</reference>
</element>
<element pattern="lua_getmetatable">
<reference><span color="blue">[-0, +(0|1), <i>-</i>]</span>
<i>int lua_getmetatable (lua_State *L, int index);</i>
Pushes onto the stack the metatable of the value at the given
acceptable index.
If the index is not valid,
or if the value does not have a metatable,
the function returns 0 and pushes nothing on the stack.
</reference>
</element>
<element pattern="lua_gettable">
<reference><span color="blue">[-1, +1, <i>e</i>]</span>
<i>void lua_gettable (lua_State *L, int index);</i>
Pushes onto the stack the value <b>t[k]</b>,
where <b>t</b> is the value at the given valid index
and <b>k</b> is the value at the top of the stack.
This function pops the key from the stack
(putting the resulting value in its place).
As in Lua, this function may trigger a metamethod
for the "index" event (see §2.8).
</reference>
</element>
<element pattern="lua_gettop">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_gettop (lua_State *L);</i>
Returns the index of the top element in the stack.
Because indices start at 1,
this result is equal to the number of elements in the stack
(and so 0 means an empty stack).
</reference>
</element>
<element pattern="lua_insert">
<reference><span color="blue">[-1, +1, <i>-</i>]</span>
<i>void lua_insert (lua_State *L, int index);</i>
Moves the top element into the given valid index,
shifting up the elements above this index to open space.
Cannot be called with a pseudo-index,
because a pseudo-index is not an actual stack position.
</reference>
</element>
<element pattern="lua_isboolean">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_isboolean (lua_State *L, int index);</i>
Returns 1 if the value at the given acceptable index has type boolean,
and 0 otherwise.
</reference>
</element>
<element pattern="lua_iscfunction">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_iscfunction (lua_State *L, int index);</i>
Returns 1 if the value at the given acceptable index is a C function,
and 0 otherwise.
</reference>
</element>
<element pattern="lua_isfunction">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_isfunction (lua_State *L, int index);</i>
Returns 1 if the value at the given acceptable index is a function
(either C or Lua), and 0 otherwise.
</reference>
</element>
<element pattern="lua_islightuserdata">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_islightuserdata (lua_State *L, int index);</i>
Returns 1 if the value at the given acceptable index is a light userdata,
and 0 otherwise.
</reference>
</element>
<element pattern="lua_isnil">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_isnil (lua_State *L, int index);</i>
Returns 1 if the value at the given acceptable index is <b>nil</b>,
and 0 otherwise.
</reference>
</element>
<element pattern="lua_isnone">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_isnone (lua_State *L, int index);</i>
Returns 1 if the given acceptable index is not valid
(that is, it refers to an element outside the current stack),
and 0 otherwise.
</reference>
</element>
<element pattern="lua_isnoneornil">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_isnoneornil (lua_State *L, int index);</i>
Returns 1 if the given acceptable index is not valid
(that is, it refers to an element outside the current stack)
or if the value at this index is <b>nil</b>,
and 0 otherwise.
</reference>
</element>
<element pattern="lua_isnumber">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_isnumber (lua_State *L, int index);</i>
Returns 1 if the value at the given acceptable index is a number
or a string convertible to a number,
and 0 otherwise.
</reference>
</element>
<element pattern="lua_isstring">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_isstring (lua_State *L, int index);</i>
Returns 1 if the value at the given acceptable index is a string
or a number (which is always convertible to a string),
and 0 otherwise.
</reference>
</element>
<element pattern="lua_istable">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_istable (lua_State *L, int index);</i>
Returns 1 if the value at the given acceptable index is a table,
and 0 otherwise.
</reference>
</element>
<element pattern="lua_isthread">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_isthread (lua_State *L, int index);</i>
Returns 1 if the value at the given acceptable index is a thread,
and 0 otherwise.
</reference>
</element>
<element pattern="lua_isuserdata">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_isuserdata (lua_State *L, int index);</i>
Returns 1 if the value at the given acceptable index is a userdata
(either full or light), and 0 otherwise.
</reference>
</element>
<element pattern="lua_lessthan">
<reference><span color="blue">[-0, +0, <i>e</i>]</span>
<i>int lua_lessthan (lua_State *L, int index1, int index2);</i>
Returns 1 if the value at acceptable index <b>index1</b> is smaller
than the value at acceptable index <b>index2</b>,
following the semantics of the Lua <b>&amp;lt;</b> operator
(that is, may call metamethods).
Otherwise returns 0.
Also returns 0 if any of the indices is non valid.
</reference>
</element>
<element pattern="lua_load">
<reference><span color="blue">[-0, +1, <i>-</i>]</span>
<i>int lua_load (lua_State *L,
              lua_Reader reader,
              void *data,
              const char *chunkname);</i>
Loads a Lua chunk.
If there are no errors,
<b>lua_load</b> pushes the compiled chunk as a Lua
function on top of the stack.
Otherwise, it pushes an error message.
The return values of <b>lua_load</b> are:
<b>0:</b> no errors;
<b>LUA_ERRSYNTAX</b>:
syntax error during pre-compilation;
<b>LUA_ERRMEM</b>:
memory allocation error.
This function only loads a chunk;
it does not run it.
<b>lua_load</b> automatically detects whether the chunk is text or binary,
and loads it accordingly (see program <b>luac</b>).
The <b>lua_load</b> function uses a user-supplied <b>reader</b> function
to read the chunk (see <b>lua_Reader</b>).
The <b>data</b> argument is an opaque value passed to the reader function.
The <b>chunkname</b> argument gives a name to the chunk,
which is used for error messages and in debug information (see §3.8).
</reference>
</element>
<element pattern="lua_newstate">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>lua_State *lua_newstate (lua_Alloc f, void *ud);</i>
Creates a new, independent state.
Returns <b>NULL</b> if cannot create the state
(due to lack of memory).
The argument <b>f</b> is the allocator function;
Lua does all memory allocation for this state through this function.
The second argument, <b>ud</b>, is an opaque pointer that Lua
simply passes to the allocator in every call.
</reference>
</element>
<element pattern="lua_newtable">
<reference><span color="blue">[-0, +1, <i>m</i>]</span>
<i>void lua_newtable (lua_State *L);</i>
Creates a new empty table and pushes it onto the stack.
It is equivalent to <b>lua_createtable(L, 0, 0)</b>.
</reference>
</element>
<element pattern="lua_newthread">
<reference><span color="blue">[-0, +1, <i>m</i>]</span>
<i>lua_State *lua_newthread (lua_State *L);</i>
Creates a new thread, pushes it on the stack,
and returns a pointer to a <b>lua_State</b> that represents this new thread.
The new state returned by this function shares with the original state
all global objects (such as tables),
but has an independent execution stack.
There is no explicit function to close or to destroy a thread.
Threads are subject to garbage collection,
like any Lua object.
</reference>
</element>
<element pattern="lua_newuserdata">
<reference><span color="blue">[-0, +1, <i>m</i>]</span>
<i>void *lua_newuserdata (lua_State *L, size_t size);</i>
This function allocates a new block of memory with the given size,
pushes onto the stack a new full userdata with the block address,
and returns this address.
Userdata represent C values in Lua.
A <i>full userdata</i> represents a block of memory.
It is an object (like a table):
you must create it, it can have its own metatable,
and you can detect when it is being collected.
A full userdata is only equal to itself (under raw equality).
When Lua collects a full userdata with a <b>gc</b> metamethod,
Lua calls the metamethod and marks the userdata as finalized.
When this userdata is collected again then
Lua frees its corresponding memory.
</reference>
</element>
<element pattern="lua_next">
<reference><span color="blue">[-1, +(2|0), <i>e</i>]</span>
<i>int lua_next (lua_State *L, int index);</i>
Pops a key from the stack,
and pushes a key-value pair from the table at the given index
(the "next" pair after the given key).
If there are no more elements in the table,
then <b>lua_next</b> returns 0 (and pushes nothing).
A typical traversal looks like this:
<i>     /* table is in the stack at index 't' */
     lua_pushnil(L);  /* first key */
     while (lua_next(L, t) != 0) {
       /* uses 'key' (at index -2) and 'value' (at index -1) */
       printf("%s - %s\n",
              lua_typename(L, lua_type(L, -2)),
              lua_typename(L, lua_type(L, -1)));
       /* removes 'value'; keeps 'key' for next iteration */
       lua_pop(L, 1);
     }
</i>
While traversing a table,
do not call <b>lua_tolstring</b> directly on a key,
unless you know that the key is actually a string.
Recall that <b>lua_tolstring</b> <i>changes</i>
the value at the given index;
this confuses the next call to <b>lua_next</b>.
</reference>
</element>
<element pattern="lua_objlen">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>size_t lua_objlen (lua_State *L, int index);</i>
Returns the "length" of the value at the given acceptable index:
for strings, this is the string length;
for tables, this is the result of the length operator ('<b>#</b>');
for userdata, this is the size of the block of memory allocated
for the userdata;
for other values, it is 0.
</reference>
</element>
<element pattern="lua_pcall">
<reference><span color="blue">[-(nargs + 1), +(nresults|1), <i>-</i>]</span>
<i>int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc);</i>
Calls a function in protected mode.
Both <b>nargs</b> and <b>nresults</b> have the same meaning as
in <b>lua_call</b>.
If there are no errors during the call,
<b>lua_pcall</b> behaves exactly like <b>lua_call</b>.
However, if there is any error,
<b>lua_pcall</b> catches it,
pushes a single value on the stack (the error message),
and returns an error code.
Like <b>lua_call</b>,
<b>lua_pcall</b> always removes the function
and its arguments from the stack.
If <b>errfunc</b> is 0,
then the error message returned on the stack
is exactly the original error message.
Otherwise, <b>errfunc</b> is the stack index of an
<i>error handler function</i>.
(In the current implementation, this index cannot be a pseudo-index.)
In case of runtime errors,
this function will be called with the error message
and its return value will be the message returned on the stack by <b>lua_pcall</b>.
Typically, the error handler function is used to add more debug
information to the error message, such as a stack traceback.
Such information cannot be gathered after the return of <b>lua_pcall</b>,
since by then the stack has unwound.
The <b>lua_pcall</b> function returns 0 in case of success
or one of the following error codes
(defined in <b>lua.h</b>):
<b>LUA_ERRRUN</b>:
a runtime error.
<b>LUA_ERRMEM</b>:
memory allocation error.
For such errors, Lua does not call the error handler function.
<b>LUA_ERRERR</b>:
error while running the error handler function.
</reference>
</element>
<element pattern="lua_pop">
<reference><span color="blue">[-n, +0, <i>-</i>]</span>
<i>void lua_pop (lua_State *L, int n);</i>
Pops <b>n</b> elements from the stack.
</reference>
</element>
<element pattern="lua_pushboolean">
<reference><span color="blue">[-0, +1, <i>-</i>]</span>
<i>void lua_pushboolean (lua_State *L, int b);</i>
Pushes a boolean value with value <b>b</b> onto the stack.
</reference>
</element>
<element pattern="lua_pushcclosure">
<reference><span color="blue">[-n, +1, <i>m</i>]</span>
<i>void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);</i>
Pushes a new C closure onto the stack.
When a C function is created,
it is possible to associate some values with it,
thus creating a C closure (see §3.4);
these values are then accessible to the function whenever it is called.
To associate values with a C function,
first these values should be pushed onto the stack
(when there are multiple values, the first value is pushed first).
Then <b>lua_pushcclosure</b>
is called to create and push the C function onto the stack,
with the argument <b>n</b> telling how many values should be
associated with the function.
<b>lua_pushcclosure</b> also pops these values from the stack.
The maximum value for <b>n</b> is 255.
</reference>
</element>
<element pattern="lua_pushcfunction">
<reference><span color="blue">[-0, +1, <i>m</i>]</span>
<i>void lua_pushcfunction (lua_State *L, lua_CFunction f);</i>
Pushes a C function onto the stack.
This function receives a pointer to a C function
and pushes onto the stack a Lua value of type <b>function</b> that,
when called, invokes the corresponding C function.
Any function to be registered in Lua must
follow the correct protocol to receive its parameters
and return its results (see <b>lua_CFunction</b>).
<b>lua_pushcfunction</b> is defined as a macro:
<i>     #define lua_pushcfunction(L,f)  lua_pushcclosure(L,f,0)
</i>
</reference>
</element>
<element pattern="lua_pushfstring">
<reference><span color="blue">[-0, +1, <i>m</i>]</span>
<i>const char *lua_pushfstring (lua_State *L, const char *fmt, ...);</i>
Pushes onto the stack a formatted string
and returns a pointer to this string.
It is similar to the C function <b>sprintf</b>,
but has some important differences:
You do not have to allocate space for the result:
the result is a Lua string and Lua takes care of memory allocation
(and deallocation, through garbage collection).
The conversion specifiers are quite restricted.
There are no flags, widths, or precisions.
The conversion specifiers can only be
'<b>%%</b>' (inserts a '<b>%</b>' in the string),
'<b>%s</b>' (inserts a zero-terminated string, with no size restrictions),
'<b>%f</b>' (inserts a <b>lua_Number</b>),
'<b>%p</b>' (inserts a pointer as a hexadecimal numeral),
'<b>%d</b>' (inserts an <b>int</b>), and
'<b>%c</b>' (inserts an <b>int</b> as a character).
</reference>
</element>
<element pattern="lua_pushinteger">
<reference><span color="blue">[-0, +1, <i>-</i>]</span>
<i>void lua_pushinteger (lua_State *L, lua_Integer n);</i>
Pushes a number with value <b>n</b> onto the stack.
</reference>
</element>
<element pattern="lua_pushlightuserdata">
<reference><span color="blue">[-0, +1, <i>-</i>]</span>
<i>void lua_pushlightuserdata (lua_State *L, void *p);</i>
Pushes a light userdata onto the stack.
Userdata represent C values in Lua.
A <i>light userdata</i> represents a pointer.
It is a value (like a number):
you do not create it, it has no individual metatable,
and it is not collected (as it was never created).
A light userdata is equal to "any"
light userdata with the same C address.
</reference>
</element>
<element pattern="lua_pushliteral">
<reference><span color="blue">[-0, +1, <i>m</i>]</span>
<i>void lua_pushliteral (lua_State *L, const char *s);</i>
This macro is equivalent to <b>lua_pushlstring</b>,
but can be used only when <b>s</b> is a literal string.
In these cases, it automatically provides the string length.
</reference>
</element>
<element pattern="lua_pushlstring">
<reference><span color="blue">[-0, +1, <i>m</i>]</span>
<i>void lua_pushlstring (lua_State *L, const char *s, size_t len);</i>
Pushes the string pointed to by <b>s</b> with size <b>len</b>
onto the stack.
Lua makes (or reuses) an internal copy of the given string,
so the memory at <b>s</b> can be freed or reused immediately after
the function returns.
The string can contain embedded zeros.
</reference>
</element>
<element pattern="lua_pushnil">
<reference><span color="blue">[-0, +1, <i>-</i>]</span>
<i>void lua_pushnil (lua_State *L);</i>
Pushes a nil value onto the stack.
</reference>
</element>
<element pattern="lua_pushnumber">
<reference><span color="blue">[-0, +1, <i>-</i>]</span>
<i>void lua_pushnumber (lua_State *L, lua_Number n);</i>
Pushes a number with value <b>n</b> onto the stack.
</reference>
</element>
<element pattern="lua_pushstring">
<reference><span color="blue">[-0, +1, <i>m</i>]</span>
<i>void lua_pushstring (lua_State *L, const char *s);</i>
Pushes the zero-terminated string pointed to by <b>s</b>
onto the stack.
Lua makes (or reuses) an internal copy of the given string,
so the memory at <b>s</b> can be freed or reused immediately after
the function returns.
The string cannot contain embedded zeros;
it is assumed to end at the first zero.
</reference>
</element>
<element pattern="lua_pushthread">
<reference><span color="blue">[-0, +1, <i>-</i>]</span>
<i>int lua_pushthread (lua_State *L);</i>
Pushes the thread represented by <b>L</b> onto the stack.
Returns 1 if this thread is the main thread of its state.
</reference>
</element>
<element pattern="lua_pushvalue">
<reference><span color="blue">[-0, +1, <i>-</i>]</span>
<i>void lua_pushvalue (lua_State *L, int index);</i>
Pushes a copy of the element at the given valid index
onto the stack.
</reference>
</element>
<element pattern="lua_pushvfstring">
<reference><span color="blue">[-0, +1, <i>m</i>]</span>
<i>const char *lua_pushvfstring (lua_State *L,
                              const char *fmt,
                              va_list argp);</i>
Equivalent to <b>lua_pushfstring</b>, except that it receives a <b>va_list</b>
instead of a variable number of arguments.
</reference>
</element>
<element pattern="lua_rawequal">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_rawequal (lua_State *L, int index1, int index2);</i>
Returns 1 if the two values in acceptable indices <b>index1</b> and
<b>index2</b> are primitively equal
(that is, without calling metamethods).
Otherwise returns 0.
Also returns 0 if any of the indices are non valid.
</reference>
</element>
<element pattern="lua_rawget">
<reference><span color="blue">[-1, +1, <i>-</i>]</span>
<i>void lua_rawget (lua_State *L, int index);</i>
Similar to <b>lua_gettable</b>, but does a raw access
(i.e., without metamethods).
</reference>
</element>
<element pattern="lua_rawgeti">
<reference><span color="blue">[-0, +1, <i>-</i>]</span>
<i>void lua_rawgeti (lua_State *L, int index, int n);</i>
Pushes onto the stack the value <b>t[n]</b>,
where <b>t</b> is the value at the given valid index.
The access is raw;
that is, it does not invoke metamethods.
</reference>
</element>
<element pattern="lua_rawset">
<reference><span color="blue">[-2, +0, <i>m</i>]</span>
<i>void lua_rawset (lua_State *L, int index);</i>
Similar to <b>lua_settable</b>, but does a raw assignment
(i.e., without metamethods).
</reference>
</element>
<element pattern="lua_rawseti">
<reference><span color="blue">[-1, +0, <i>m</i>]</span>
<i>void lua_rawseti (lua_State *L, int index, int n);</i>
Does the equivalent of <b>t[n] = v</b>,
where <b>t</b> is the value at the given valid index
and <b>v</b> is the value at the top of the stack.
This function pops the value from the stack.
The assignment is raw;
that is, it does not invoke metamethods.
</reference>
</element>
<element pattern="lua_register">
<reference><span color="blue">[-0, +0, <i>e</i>]</span>
<i>void lua_register (lua_State *L,
                   const char *name,
                   lua_CFunction f);</i>
Sets the C function <b>f</b> as the new value of global <b>name</b>.
It is defined as a macro:
<i>     #define lua_register(L,n,f) \
            (lua_pushcfunction(L, f), lua_setglobal(L, n))
</i>
</reference>
</element>
<element pattern="lua_remove">
<reference><span color="blue">[-1, +0, <i>-</i>]</span>
<i>void lua_remove (lua_State *L, int index);</i>
Removes the element at the given valid index,
shifting down the elements above this index to fill the gap.
Cannot be called with a pseudo-index,
because a pseudo-index is not an actual stack position.
</reference>
</element>
<element pattern="lua_replace">
<reference><span color="blue">[-1, +0, <i>-</i>]</span>
<i>void lua_replace (lua_State *L, int index);</i>
Moves the top element into the given position (and pops it),
without shifting any element
(therefore replacing the value at the given position).
</reference>
</element>
<element pattern="lua_resume">
<reference><span color="blue">[-?, +?, <i>-</i>]</span>
<i>int lua_resume (lua_State *L, int narg);</i>
Starts and resumes a coroutine in a given thread.
To start a coroutine, you first create a new thread
(see <b>lua_newthread</b>);
then you push onto its stack the main function plus any arguments;
then you call <b>lua_resume</b>,
with <b>narg</b> being the number of arguments.
This call returns when the coroutine suspends or finishes its execution.
When it returns, the stack contains all values passed to <b>lua_yield</b>,
or all values returned by the body function.
<b>lua_resume</b> returns
<b>LUA_YIELD</b> if the coroutine yields,
0 if the coroutine finishes its execution
without errors,
or an error code in case of errors (see <b>lua_pcall</b>).
In case of errors,
the stack is not unwound,
so you can use the debug API over it.
The error message is on the top of the stack.
To restart a coroutine, you put on its stack only the values to
be passed as results from <b>yield</b>,
and then call <b>lua_resume</b>.
</reference>
</element>
<element pattern="lua_setallocf">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);</i>
Changes the allocator function of a given state to <b>f</b>
with user data <b>ud</b>.
</reference>
</element>
<element pattern="lua_setfenv">
<reference><span color="blue">[-1, +0, <i>-</i>]</span>
<i>int lua_setfenv (lua_State *L, int index);</i>
Pops a table from the stack and sets it as
the new environment for the value at the given index.
If the value at the given index is
neither a function nor a thread nor a userdata,
<b>lua_setfenv</b> returns 0.
Otherwise it returns 1.
</reference>
</element>
<element pattern="lua_setfield">
<reference><span color="blue">[-1, +0, <i>e</i>]</span>
<i>void lua_setfield (lua_State *L, int index, const char *k);</i>
Does the equivalent to <b>t[k] = v</b>,
where <b>t</b> is the value at the given valid index
and <b>v</b> is the value at the top of the stack.
This function pops the value from the stack.
As in Lua, this function may trigger a metamethod
for the "newindex" event (see §2.8).
</reference>
</element>
<element pattern="lua_setglobal">
<reference><span color="blue">[-1, +0, <i>e</i>]</span>
<i>void lua_setglobal (lua_State *L, const char *name);</i>
Pops a value from the stack and
sets it as the new value of global <b>name</b>.
It is defined as a macro:
<i>     #define lua_setglobal(L,s)   lua_setfield(L, LUA_GLOBALSINDEX, s)
</i>
</reference>
</element>
<element pattern="lua_setmetatable">
<reference><span color="blue">[-1, +0, <i>-</i>]</span>
<i>int lua_setmetatable (lua_State *L, int index);</i>
Pops a table from the stack and
sets it as the new metatable for the value at the given
acceptable index.
</reference>
</element>
<element pattern="lua_settable">
<reference><span color="blue">[-2, +0, <i>e</i>]</span>
<i>void lua_settable (lua_State *L, int index);</i>
Does the equivalent to <b>t[k] = v</b>,
where <b>t</b> is the value at the given valid index,
<b>v</b> is the value at the top of the stack,
and <b>k</b> is the value just below the top.
This function pops both the key and the value from the stack.
As in Lua, this function may trigger a metamethod
for the "newindex" event (see §2.8).
</reference>
</element>
<element pattern="lua_settop">
<reference><span color="blue">[-?, +?, <i>-</i>]</span>
<i>void lua_settop (lua_State *L, int index);</i>
Accepts any acceptable index, or 0,
and sets the stack top to this index.
If the new top is larger than the old one,
then the new elements are filled with <b>nil</b>.
If <b>index</b> is 0, then all stack elements are removed.
</reference>
</element>
<element pattern="lua_status">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_status (lua_State *L);</i>
Returns the status of the thread <b>L</b>.
The status can be 0 for a normal thread,
an error code if the thread finished its execution with an error,
or <b>LUA_YIELD</b> if the thread is suspended.
</reference>
</element>
<element pattern="lua_toboolean">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_toboolean (lua_State *L, int index);</i>
Converts the Lua value at the given acceptable index to a C boolean
value (0 or 1).
Like all tests in Lua,
<b>lua_toboolean</b> returns 1 for any Lua value
different from <b>false</b> and <b>nil</b>;
otherwise it returns 0.
It also returns 0 when called with a non-valid index.
(If you want to accept only actual boolean values,
use <b>lua_isboolean</b> to test the value's type.)
</reference>
</element>
<element pattern="lua_tocfunction">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>lua_CFunction lua_tocfunction (lua_State *L, int index);</i>
Converts a value at the given acceptable index to a C function.
That value must be a C function;
otherwise, returns <b>NULL</b>.
</reference>
</element>
<element pattern="lua_tointeger">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>lua_Integer lua_tointeger (lua_State *L, int index);</i>
Converts the Lua value at the given acceptable index
to the signed integral type <b>lua_Integer</b>.
The Lua value must be a number or a string convertible to a number
(see §2.2.1);
otherwise, <b>lua_tointeger</b> returns 0.
If the number is not an integer,
it is truncated in some non-specified way.
</reference>
</element>
<element pattern="lua_tolstring">
<reference><span color="blue">[-0, +0, <i>m</i>]</span>
<i>const char *lua_tolstring (lua_State *L, int index, size_t *len);</i>
Converts the Lua value at the given acceptable index to a C string.
If <b>len</b> is not <b>NULL</b>,
it also sets <b>*len</b> with the string length.
The Lua value must be a string or a number;
otherwise, the function returns <b>NULL</b>.
If the value is a number,
then <b>lua_tolstring</b> also
<i>changes the actual value in the stack to a string</i>.
(This change confuses <b>lua_next</b>
when <b>lua_tolstring</b> is applied to keys during a table traversal.)
<b>lua_tolstring</b> returns a fully aligned pointer
to a string inside the Lua state.
This string always has a zero ('<b>\0</b>')
after its last character (as in C),
but can contain other zeros in its body.
Because Lua has garbage collection,
there is no guarantee that the pointer returned by <b>lua_tolstring</b>
will be valid after the corresponding value is removed from the stack.
</reference>
</element>
<element pattern="lua_tonumber">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>lua_Number lua_tonumber (lua_State *L, int index);</i>
Converts the Lua value at the given acceptable index
to the C type <b>lua_Number</b> (see <b>lua_Number</b>).
The Lua value must be a number or a string convertible to a number
(see §2.2.1);
otherwise, <b>lua_tonumber</b> returns 0.
</reference>
</element>
<element pattern="lua_topointer">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>const void *lua_topointer (lua_State *L, int index);</i>
Converts the value at the given acceptable index to a generic
C pointer (<b>void*</b>).
The value can be a userdata, a table, a thread, or a function;
otherwise, <b>lua_topointer</b> returns <b>NULL</b>.
Different objects will give different pointers.
There is no way to convert the pointer back to its original value.
Typically this function is used only for debug information.
</reference>
</element>
<element pattern="lua_tostring">
<reference><span color="blue">[-0, +0, <i>m</i>]</span>
<i>const char *lua_tostring (lua_State *L, int index);</i>
Equivalent to <b>lua_tolstring</b> with <b>len</b> equal to <b>NULL</b>.
</reference>
</element>
<element pattern="lua_tothread">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>lua_State *lua_tothread (lua_State *L, int index);</i>
Converts the value at the given acceptable index to a Lua thread
(represented as <b>lua_State*</b>).
This value must be a thread;
otherwise, the function returns <b>NULL</b>.
</reference>
</element>
<element pattern="lua_touserdata">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>void *lua_touserdata (lua_State *L, int index);</i>
If the value at the given acceptable index is a full userdata,
returns its block address.
If the value is a light userdata,
returns its pointer.
Otherwise, returns <b>NULL</b>.
</reference>
</element>
<element pattern="lua_type">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_type (lua_State *L, int index);</i>
Returns the type of the value in the given acceptable index,
or <b>LUA_TNONE</b> for a non-valid index
(that is, an index to an "empty" stack position).
The types returned by <b>lua_type</b> are coded by the following constants
defined in <b>lua.h</b>:
<b>LUA_TNIL</b>,
<b>LUA_TNUMBER</b>,
<b>LUA_TBOOLEAN</b>,
<b>LUA_TSTRING</b>,
<b>LUA_TTABLE</b>,
<b>LUA_TFUNCTION</b>,
<b>LUA_TUSERDATA</b>,
<b>LUA_TTHREAD</b>,
and
<b>LUA_TLIGHTUSERDATA</b>.
</reference>
</element>
<element pattern="lua_typename">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>const char *lua_typename  (lua_State *L, int tp);</i>
Returns the name of the type encoded by the value <b>tp</b>,
which must be one the values returned by <b>lua_type</b>.
</reference>
</element>
<element pattern="lua_xmove">
<reference><span color="blue">[-?, +?, <i>-</i>]</span>
<i>void lua_xmove (lua_State *from, lua_State *to, int n);</i>
Exchange values between different threads of the <i>same</i> global state.
This function pops <b>n</b> values from the stack <b>from</b>,
and pushes them onto the stack <b>to</b>.
</reference>
</element>
<element pattern="lua_yield">
<reference><span color="blue">[-?, +?, <i>-</i>]</span>
<i>int lua_yield  (lua_State *L, int nresults);</i>
Yields a coroutine.
This function should only be called as the
return expression of a C function, as follows:
<i>     return lua_yield (L, nresults);
</i>
When a C function calls <b>lua_yield</b> in that way,
the running coroutine suspends its execution,
and the call to <b>lua_resume</b> that started this coroutine returns.
The parameter <b>nresults</b> is the number of values from the stack
that are passed as results to <b>lua_resume</b>.
</reference>
</element>
<element pattern="lua_gethook">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>lua_Hook lua_gethook (lua_State *L);</i>
Returns the current hook function.
</reference>
</element>
<element pattern="lua_gethookcount">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_gethookcount (lua_State *L);</i>
Returns the current hook count.
</reference>
</element>
<element pattern="lua_gethookmask">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_gethookmask (lua_State *L);</i>
Returns the current hook mask.
</reference>
</element>
<element pattern="lua_getinfo">
<reference><span color="blue">[-(0|1), +(0|1|2), <i>m</i>]</span>
<i>int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);</i>
Returns information about a specific function or function invocation.
To get information about a function invocation,
the parameter <b>ar</b> must be a valid activation record that was
filled by a previous call to <b>lua_getstack</b> or
given as argument to a hook (see <b>lua_Hook</b>).
To get information about a function you push it onto the stack
and start the <b>what</b> string with the character '<b>&gt;</b>'.
(In that case,
<b>lua_getinfo</b> pops the function in the top of the stack.)
For instance, to know in which line a function <b>f</b> was defined,
you can write the following code:
<i>     lua_Debug ar;
     lua_getfield(L, LUA_GLOBALSINDEX, "f");  /* get global 'f' */
     lua_getinfo(L, "&gt;S", &amp;ar);
     printf("%d\n", ar.linedefined);
</i>
Each character in the string <b>what</b>
selects some fields of the structure <b>ar</b> to be filled or
a value to be pushed on the stack:
<b>'<b>n</b>':</b> fills in the field <b>name</b> and <b>namewhat</b>;
<b>'<b>S</b>':</b>
fills in the fields <b>source</b>, <b>short_src</b>,
<b>linedefined</b>, <b>lastlinedefined</b>, and <b>what</b>;
<b>'<b>l</b>':</b> fills in the field <b>currentline</b>;
<b>'<b>u</b>':</b> fills in the field <b>nups</b>;
<b>'<b>f</b>':</b>
pushes onto the stack the function that is
running at the given level;
<b>'<b>L</b>':</b>
pushes onto the stack a table whose indices are the
numbers of the lines that are valid on the function.
(A <i>valid line</i> is a line with some associated code,
that is, a line where you can put a break point.
Non-valid lines include empty lines and comments.)
This function returns 0 on error
(for instance, an invalid option in <b>what</b>).
</reference>
</element>
<element pattern="lua_getlocal">
<reference><span color="blue">[-0, +(0|1), <i>-</i>]</span>
<i>const char *lua_getlocal (lua_State *L, lua_Debug *ar, int n);</i>
Gets information about a local variable of a given activation record.
The parameter <b>ar</b> must be a valid activation record that was
filled by a previous call to <b>lua_getstack</b> or
given as argument to a hook (see <b>lua_Hook</b>).
The index <b>n</b> selects which local variable to inspect
(1 is the first parameter or active local variable, and so on,
until the last active local variable).
<b>lua_getlocal</b> pushes the variable's value onto the stack
and returns its name.
Variable names starting with '<b>(</b>' (open parentheses)
represent internal variables
(loop control variables, temporaries, and C function locals).
Returns <b>NULL</b> (and pushes nothing)
when the index is greater than
the number of active local variables.
</reference>
</element>
<element pattern="lua_getstack">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_getstack (lua_State *L, int level, lua_Debug *ar);</i>
Get information about the interpreter runtime stack.
This function fills parts of a <b>lua_Debug</b> structure with
an identification of the <i>activation record</i>
of the function executing at a given level.
Level 0 is the current running function,
whereas level <i>n+1</i> is the function that has called level <i>n</i>.
When there are no errors, <b>lua_getstack</b> returns 1;
when called with a level greater than the stack depth,
it returns 0.
</reference>
</element>
<element pattern="lua_getupvalue">
<reference><span color="blue">[-0, +(0|1), <i>-</i>]</span>
<i>const char *lua_getupvalue (lua_State *L, int funcindex, int n);</i>
Gets information about a closure's upvalue.
(For Lua functions,
upvalues are the external local variables that the function uses,
and that are consequently included in its closure.)
<b>lua_getupvalue</b> gets the index <b>n</b> of an upvalue,
pushes the upvalue's value onto the stack,
and returns its name.
<b>funcindex</b> points to the closure in the stack.
(Upvalues have no particular order,
as they are active through the whole function.
So, they are numbered in an arbitrary order.)
Returns <b>NULL</b> (and pushes nothing)
when the index is greater than the number of upvalues.
For C functions, this function uses the empty string <b>""</b>
as a name for all upvalues.
</reference>
</element>
<element pattern="lua_sethook">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
<i>int lua_sethook (lua_State *L, lua_Hook f, int mask, int count);</i>
Sets the debugging hook function.
Argument <b>f</b> is the hook function.
<b>mask</b> specifies on which events the hook will be called:
it is formed by a bitwise or of the constants
<b>LUA_MASKCALL</b>,
<b>LUA_MASKRET</b>,
<b>LUA_MASKLINE</b>,
and <b>LUA_MASKCOUNT</b>.
The <b>count</b> argument is only meaningful when the mask
includes <b>LUA_MASKCOUNT</b>.
For each event, the hook is called as explained below:
<b>The call hook:</b> is called when the interpreter calls a function.
The hook is called just after Lua enters the new function,
before the function gets its arguments.
<b>The return hook:</b> is called when the interpreter returns from a function.
The hook is called just before Lua leaves the function.
You have no access to the values to be returned by the function.
<b>The line hook:</b> is called when the interpreter is about to
start the execution of a new line of code,
or when it jumps back in the code (even to the same line).
(This event only happens while Lua is executing a Lua function.)
<b>The count hook:</b> is called after the interpreter executes every
<b>count</b> instructions.
(This event only happens while Lua is executing a Lua function.)
A hook is disabled by setting <b>mask</b> to zero.
</reference>
</element>
<element pattern="lua_setlocal">
<reference><span color="blue">[-(0|1), +0, <i>-</i>]</span>
<i>const char *lua_setlocal (lua_State *L, lua_Debug *ar, int n);</i>
Sets the value of a local variable of a given activation record.
Parameters <b>ar</b> and <b>n</b> are as in <b>lua_getlocal</b>
(see <b>lua_getlocal</b>).
<b>lua_setlocal</b> assigns the value at the top of the stack
to the variable and returns its name.
It also pops the value from the stack.
Returns <b>NULL</b> (and pops nothing)
when the index is greater than
the number of active local variables.
</reference>
</element>
<element pattern="lua_setupvalue">
<reference><span color="blue">[-(0|1), +0, <i>-</i>]</span>
<i>const char *lua_setupvalue (lua_State *L, int funcindex, int n);</i>
Sets the value of a closure's upvalue.
It assigns the value at the top of the stack
to the upvalue and returns its name.
It also pops the value from the stack.
Parameters <b>funcindex</b> and <b>n</b> are as in the <b>lua_getupvalue</b>
(see <b>lua_getupvalue</b>).
Returns <b>NULL</b> (and pops nothing)
when the index is greater than the number of upvalues.
</reference>
</element>
<element pattern="luaL_addchar">
<reference><span color="blue">[-0, +0, <i>m</i>]</span>
void luaL_addchar (luaL_Buffer *B, char c);
Adds the character <b>c</b> to the buffer <b>B</b>
(see <b>luaL_Buffer</b>).
</reference>
</element>
<element pattern="luaL_addlstring">
<reference><span color="blue">[-0, +0, <i>m</i>]</span>
void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);
Adds the string pointed to by <b>s</b> with length <b>l</b> to
the buffer <b>B</b>
(see <b>luaL_Buffer</b>).
The string may contain embedded zeros.
</reference>
</element>
<element pattern="luaL_addsize">
<reference><span color="blue">[-0, +0, <i>m</i>]</span>
void luaL_addsize (luaL_Buffer *B, size_t n);
Adds to the buffer <b>B</b> (see <b>luaL_Buffer</b>)
a string of length <b>n</b> previously copied to the
buffer area (see <b>luaL_prepbuffer</b>).
</reference>
</element>
<element pattern="luaL_addstring">
<reference><span color="blue">[-0, +0, <i>m</i>]</span>
void luaL_addstring (luaL_Buffer *B, const char *s);
Adds the zero-terminated string pointed to by <b>s</b>
to the buffer <b>B</b>
(see <b>luaL_Buffer</b>).
The string may not contain embedded zeros.
</reference>
</element>
<element pattern="luaL_addvalue">
<reference><span color="blue">[-1, +0, <i>m</i>]</span>
void luaL_addvalue (luaL_Buffer *B);
Adds the value at the top of the stack
to the buffer <b>B</b>
(see <b>luaL_Buffer</b>).
Pops the value.
This is the only function on string buffers that can (and must)
be called with an extra element on the stack,
which is the value to be added to the buffer.
</reference>
</element>
<element pattern="luaL_argcheck">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
void luaL_argcheck (lua_State *L,
                    int cond,
                    int narg,
                    const char *extramsg);
Checks whether <b>cond</b> is true.
If not, raises an error with the following message,
where <b>func</b> is retrieved from the call stack:
     bad argument #&amp;lt;narg&amp;gt; to &amp;lt;func&amp;gt; (&amp;lt;extramsg&amp;gt;)
</reference>
</element>
<element pattern="luaL_argerror">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
int luaL_argerror (lua_State *L, int narg, const char *extramsg);
Raises an error with the following message,
where <b>func</b> is retrieved from the call stack:
     bad argument #&amp;lt;narg&amp;gt; to &amp;lt;func&amp;gt; (&amp;lt;extramsg&amp;gt;)
This function never returns,
but it is an idiom to use it in C functions
as <b>return luaL_argerror(<i>args</i>)</b>.
</reference>
</element>
<element pattern="luaL_buffinit">
<reference><span color="blue">[-0, +0, <i>e</i>]</span>
void luaL_buffinit (lua_State *L, luaL_Buffer *B);
Initializes a buffer <b>B</b>.
This function does not allocate any space;
the buffer must be declared as a variable
(see <b>luaL_Buffer</b>).
</reference>
</element>
<element pattern="luaL_callmeta">
<reference><span color="blue">[-0, +(0|1), <i>e</i>]</span>
int luaL_callmeta (lua_State *L, int obj, const char *e);
Calls a metamethod.
If the object at index <b>obj</b> has a metatable and this
metatable has a field <b>e</b>,
this function calls this field and passes the object as its only argument.
In this case this function returns 1 and pushes onto the
stack the value returned by the call.
If there is no metatable or no metamethod,
this function returns 0 (without pushing any value on the stack).
</reference>
</element>
<element pattern="luaL_checkany">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
void luaL_checkany (lua_State *L, int narg);
Checks whether the function has an argument
of any type (including <b>nil</b>) at position <b>narg</b>.
</reference>
</element>
<element pattern="luaL_checkint">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
int luaL_checkint (lua_State *L, int narg);
Checks whether the function argument <b>narg</b> is a number
and returns this number cast to an <b>int</b>.
</reference>
</element>
<element pattern="luaL_checkinteger">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
lua_Integer luaL_checkinteger (lua_State *L, int narg);
Checks whether the function argument <b>narg</b> is a number
and returns this number cast to a <b>lua_Integer</b>.
</reference>
</element>
<element pattern="luaL_checklong">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
long luaL_checklong (lua_State *L, int narg);
Checks whether the function argument <b>narg</b> is a number
and returns this number cast to a <b>long</b>.
</reference>
</element>
<element pattern="luaL_checklstring">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
const char *luaL_checklstring (lua_State *L, int narg, size_t *l);
Checks whether the function argument <b>narg</b> is a string
and returns this string;
if <b>l</b> is not <b>NULL</b> fills <b>*l</b>
with the string's length.
This function uses <b>lua_tolstring</b> to get its result,
so all conversions and caveats of that function apply here.
</reference>
</element>
<element pattern="luaL_checknumber">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
lua_Number luaL_checknumber (lua_State *L, int narg);
Checks whether the function argument <b>narg</b> is a number
and returns this number.
</reference>
</element>
<element pattern="luaL_checkoption">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
int luaL_checkoption (lua_State *L,
                      int narg,
                      const char *def,
                      const char *const lst[]);
Checks whether the function argument <b>narg</b> is a string and
searches for this string in the array <b>lst</b>
(which must be NULL-terminated).
Returns the index in the array where the string was found.
Raises an error if the argument is not a string or
if the string cannot be found.
If <b>def</b> is not <b>NULL</b>,
the function uses <b>def</b> as a default value when
there is no argument <b>narg</b> or if this argument is <b>nil</b>.
This is a useful function for mapping strings to C enums.
(The usual convention in Lua libraries is
to use strings instead of numbers to select options.)
</reference>
</element>
<element pattern="luaL_checkstack">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
void luaL_checkstack (lua_State *L, int sz, const char *msg);
Grows the stack size to <b>top + sz</b> elements,
raising an error if the stack cannot grow to that size.
<b>msg</b> is an additional text to go into the error message.
</reference>
</element>
<element pattern="luaL_checkstring">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
const char *luaL_checkstring (lua_State *L, int narg);
Checks whether the function argument <b>narg</b> is a string
and returns this string.
This function uses <b>lua_tolstring</b> to get its result,
so all conversions and caveats of that function apply here.
</reference>
</element>
<element pattern="luaL_checktype">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
void luaL_checktype (lua_State *L, int narg, int t);
Checks whether the function argument <b>narg</b> has type <b>t</b>.
See <b>lua_type</b> for the encoding of types for <b>t</b>.
</reference>
</element>
<element pattern="luaL_checkudata">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
void *luaL_checkudata (lua_State *L, int narg, const char *tname);
Checks whether the function argument <b>narg</b> is a userdata
of the type <b>tname</b> (see <b>luaL_newmetatable</b>).
</reference>
</element>
<element pattern="luaL_dofile">
<reference><span color="blue">[-0, +?, <i>m</i>]</span>
int luaL_dofile (lua_State *L, const char *filename);
Loads and runs the given file.
It is defined as the following macro:
     (luaL_loadfile(L, filename) || lua_pcall(L, 0, LUA_MULTRET, 0))
It returns 0 if there are no errors
or 1 in case of errors.
</reference>
</element>
<element pattern="luaL_dostring">
<reference><span color="blue">[-0, +?, <i>m</i>]</span>
int luaL_dostring (lua_State *L, const char *str);
Loads and runs the given string.
It is defined as the following macro:
     (luaL_loadstring(L, str) || lua_pcall(L, 0, LUA_MULTRET, 0))
It returns 0 if there are no errors
or 1 in case of errors.
</reference>
</element>
<element pattern="luaL_error">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
int luaL_error (lua_State *L, const char *fmt, ...);
Raises an error.
The error message format is given by <b>fmt</b>
plus any extra arguments,
following the same rules of <b>lua_pushfstring</b>.
It also adds at the beginning of the message the file name and
the line number where the error occurred,
if this information is available.
This function never returns,
but it is an idiom to use it in C functions
as <b>return luaL_error(<i>args</i>)</b>.
</reference>
</element>
<element pattern="luaL_getmetafield">
<reference><span color="blue">[-0, +(0|1), <i>m</i>]</span>
int luaL_getmetafield (lua_State *L, int obj, const char *e);
Pushes onto the stack the field <b>e</b> from the metatable
of the object at index <b>obj</b>.
If the object does not have a metatable,
or if the metatable does not have this field,
returns 0 and pushes nothing.
</reference>
</element>
<element pattern="luaL_getmetatable">
<reference><span color="blue">[-0, +1, <i>-</i>]</span>
void luaL_getmetatable (lua_State *L, const char *tname);
Pushes onto the stack the metatable associated with name <b>tname</b>
in the registry (see <b>luaL_newmetatable</b>).
</reference>
</element>
<element pattern="luaL_gsub">
<reference><span color="blue">[-0, +1, <i>m</i>]</span>
const char *luaL_gsub (lua_State *L,
                       const char *s,
                       const char *p,
                       const char *r);
Creates a copy of string <b>s</b> by replacing
any occurrence of the string <b>p</b>
with the string <b>r</b>.
Pushes the resulting string on the stack and returns it.
</reference>
</element>
<element pattern="luaL_loadbuffer">
<reference><span color="blue">[-0, +1, <i>m</i>]</span>
int luaL_loadbuffer (lua_State *L,
                     const char *buff,
                     size_t sz,
                     const char *name);
Loads a buffer as a Lua chunk.
This function uses <b>lua_load</b> to load the chunk in the
buffer pointed to by <b>buff</b> with size <b>sz</b>.
This function returns the same results as <b>lua_load</b>.
<b>name</b> is the chunk name,
used for debug information and error messages.
</reference>
</element>
<element pattern="luaL_loadfile">
<reference><span color="blue">[-0, +1, <i>m</i>]</span>
int luaL_loadfile (lua_State *L, const char *filename);
Loads a file as a Lua chunk.
This function uses <b>lua_load</b> to load the chunk in the file
named <b>filename</b>.
If <b>filename</b> is <b>NULL</b>,
then it loads from the standard input.
The first line in the file is ignored if it starts with a <b>#</b>.
This function returns the same results as <b>lua_load</b>,
but it has an extra error code <b>LUA_ERRFILE</b>
if it cannot open/read the file.
As <b>lua_load</b>, this function only loads the chunk;
it does not run it.
</reference>
</element>
<element pattern="luaL_loadstring">
<reference><span color="blue">[-0, +1, <i>m</i>]</span>
int luaL_loadstring (lua_State *L, const char *s);
Loads a string as a Lua chunk.
This function uses <b>lua_load</b> to load the chunk in
the zero-terminated string <b>s</b>.
This function returns the same results as <b>lua_load</b>.
Also as <b>lua_load</b>, this function only loads the chunk;
it does not run it.
</reference>
</element>
<element pattern="luaL_newmetatable">
<reference><span color="blue">[-0, +1, <i>m</i>]</span>
int luaL_newmetatable (lua_State *L, const char *tname);
If the registry already has the key <b>tname</b>,
returns 0.
Otherwise,
creates a new table to be used as a metatable for userdata,
adds it to the registry with key <b>tname</b>,
and returns 1.
In both cases pushes onto the stack the final value associated
with <b>tname</b> in the registry.
</reference>
</element>
<element pattern="luaL_newstate">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
lua_State *luaL_newstate (void);
Creates a new Lua state.
It calls <b>lua_newstate</b> with an
allocator based on the standard C <b>realloc</b> function
and then sets a panic function (see <b>lua_atpanic</b>) that prints
an error message to the standard error output in case of fatal
errors.
Returns the new state,
or <b>NULL</b> if there is a memory allocation error.
</reference>
</element>
<element pattern="luaL_openlibs">
<reference><span color="blue">[-0, +0, <i>m</i>]</span>
void luaL_openlibs (lua_State *L);
Opens all standard Lua libraries into the given state.
</reference>
</element>
<element pattern="luaL_optint">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
int luaL_optint (lua_State *L, int narg, int d);
If the function argument <b>narg</b> is a number,
returns this number cast to an <b>int</b>.
If this argument is absent or is <b>nil</b>,
returns <b>d</b>.
Otherwise, raises an error.
</reference>
</element>
<element pattern="luaL_optinteger">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
lua_Integer luaL_optinteger (lua_State *L,
                             int narg,
                             lua_Integer d);
If the function argument <b>narg</b> is a number,
returns this number cast to a <b>lua_Integer</b>.
If this argument is absent or is <b>nil</b>,
returns <b>d</b>.
Otherwise, raises an error.
</reference>
</element>
<element pattern="luaL_optlong">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
long luaL_optlong (lua_State *L, int narg, long d);
If the function argument <b>narg</b> is a number,
returns this number cast to a <b>long</b>.
If this argument is absent or is <b>nil</b>,
returns <b>d</b>.
Otherwise, raises an error.
</reference>
</element>
<element pattern="luaL_optlstring">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
const char *luaL_optlstring (lua_State *L,
                             int narg,
                             const char *d,
                             size_t *l);
If the function argument <b>narg</b> is a string,
returns this string.
If this argument is absent or is <b>nil</b>,
returns <b>d</b>.
Otherwise, raises an error.
If <b>l</b> is not <b>NULL</b>,
fills the position <b>*l</b> with the results's length.
</reference>
</element>
<element pattern="luaL_optnumber">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number d);
If the function argument <b>narg</b> is a number,
returns this number.
If this argument is absent or is <b>nil</b>,
returns <b>d</b>.
Otherwise, raises an error.
</reference>
</element>
<element pattern="luaL_optstring">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
const char *luaL_optstring (lua_State *L,
                            int narg,
                            const char *d);
If the function argument <b>narg</b> is a string,
returns this string.
If this argument is absent or is <b>nil</b>,
returns <b>d</b>.
Otherwise, raises an error.
</reference>
</element>
<element pattern="luaL_prepbuffer">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
char *luaL_prepbuffer (luaL_Buffer *B);
Returns an address to a space of size <b>LUAL_BUFFERSIZE</b>
where you can copy a string to be added to buffer <b>B</b>
(see <b>luaL_Buffer</b>).
After copying the string into this space you must call
<b>luaL_addsize</b> with the size of the string to actually add 
it to the buffer.
</reference>
</element>
<element pattern="luaL_pushresult">
<reference><span color="blue">[-?, +1, <i>m</i>]</span>
void luaL_pushresult (luaL_Buffer *B);
Finishes the use of buffer <b>B</b> leaving the final string on
the top of the stack.
</reference>
</element>
<element pattern="luaL_ref">
<reference><span color="blue">[-1, +0, <i>m</i>]</span>
int luaL_ref (lua_State *L, int t);
Creates and returns a <i>reference</i>,
in the table at index <b>t</b>,
for the object at the top of the stack (and pops the object).
A reference is a unique integer key.
As long as you do not manually add integer keys into table <b>t</b>,
<b>luaL_ref</b> ensures the uniqueness of the key it returns.
You can retrieve an object referred by reference <b>r</b>
by calling <b>lua_rawgeti(L, t, r)</b>.
Function <b>luaL_unref</b> frees a reference and its associated object.
If the object at the top of the stack is <b>nil</b>,
<b>luaL_ref</b> returns the constant <b>LUA_REFNIL</b>.
The constant <b>LUA_NOREF</b> is guaranteed to be different
from any reference returned by <b>luaL_ref</b>.
</reference>
</element>
<element pattern="luaL_register">
<reference><span color="blue">[-(0|1), +1, <i>m</i>]</span>
void luaL_register (lua_State *L,
                    const char *libname,
                    const luaL_Reg *l);
Opens a library.
When called with <b>libname</b> equal to <b>NULL</b>,
it simply registers all functions in the list <b>l</b>
(see <b>luaL_Reg</b>) into the table on the top of the stack.
When called with a non-null <b>libname</b>,
<b>luaL_register</b> creates a new table <b>t</b>,
sets it as the value of the global variable <b>libname</b>,
sets it as the value of <b>package.loaded[libname]</b>,
and registers on it all functions in the list <b>l</b>.
If there is a table in <b>package.loaded[libname]</b> or in
variable <b>libname</b>,
reuses this table instead of creating a new one.
In any case the function leaves the table
on the top of the stack.
</reference>
</element>
<element pattern="luaL_typename">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
const char *luaL_typename (lua_State *L, int index);
Returns the name of the type of the value at the given index.
</reference>
</element>
<element pattern="luaL_typerror">
<reference><span color="blue">[-0, +0, <i>v</i>]</span>
int luaL_typerror (lua_State *L, int narg, const char *tname);
Generates an error with a message like the following:
     <i>location</i>: bad argument <i>narg</i> to '<i>func</i>' (<i>tname</i> expected, got <i>rt</i>)
where <b><i>location</i></b> is produced by <b>luaL_where</b>,
<b><i>func</i></b> is the name of the current function,
and <b><i>rt</i></b> is the type name of the actual argument.
</reference>
</element>
<element pattern="luaL_unref">
<reference><span color="blue">[-0, +0, <i>-</i>]</span>
void luaL_unref (lua_State *L, int t, int ref);
Releases reference <b>ref</b> from the table at index <b>t</b>
(see <b>luaL_ref</b>).
The entry is removed from the table,
so that the referred object can be collected.
The reference <b>ref</b> is also freed to be used again.
If <b>ref</b> is <b>LUA_NOREF</b> or <b>LUA_REFNIL</b>,
<b>luaL_unref</b> does nothing.
</reference>
</element>
<element pattern="luaL_where">
<reference><span color="blue">[-0, +1, <i>m</i>]</span>
void luaL_where (lua_State *L, int lvl);
Pushes onto the stack a string identifying the current position
of the control at level <b>lvl</b> in the call stack.
Typically this string has the following format:
     <i>chunkname</i>:<i>currentline</i>:
Level 0 is the running function,
level 1 is the function that called the running function,
etc.
This function is used to build a prefix for error messages.
</reference>
</element>
<element pattern="assert">
<reference><span color="blue">assert (v [, message])</span>
Issues an  error when
the value of its argument <b>v</b> is false (i.e., <b>nil</b> or <b>false</b>);
otherwise, returns all its arguments.
<b>message</b> is an error message;
when absent, it defaults to "assertion failed!"
</reference>
</element>
<element pattern="collectgarbage">
<reference><span color="blue">collectgarbage (opt [, arg])</span>
This function is a generic interface to the garbage collector.
It performs different functions according to its first argument, <b>opt</b>:
<b>"stop":</b>
stops the garbage collector.
<b>"restart":</b>
restarts the garbage collector.
<b>"collect":</b>
performs a full garbage-collection cycle.
<b>"count":</b>
returns the total memory in use by Lua (in Kbytes).
<b>"step":</b>
performs a garbage-collection step.
The step "size" is controlled by <b>arg</b>
(larger values mean more steps) in a non-specified way.
If you want to control the step size
you must experimentally tune the value of <b>arg</b>.
Returns <b>true</b> if the step finished a collection cycle.
<b>"setpause":</b>
sets <b>arg</b> as the new value for the <i>pause</i> of
the collector (see §2.10).
Returns the previous value for <i>pause</i>.
<b>"setstepmul":</b>
sets <b>arg</b> as the new value for the <i>step multiplier</i> of
the collector (see §2.10).
Returns the previous value for <i>step</i>.
</reference>
</element>
<element pattern="dofile">
<reference><span color="blue">dofile (filename)</span>
Opens the named file and executes its contents as a Lua chunk.
When called without arguments,
<b>dofile</b> executes the contents of the standard input (<b>stdin</b>).
Returns all values returned by the chunk.
In case of errors, <b>dofile</b> propagates the error
to its caller (that is, <b>dofile</b> does not run in protected mode).
</reference>
</element>
<element pattern="error">
<reference><span color="blue">error (message [, level])</span>
Terminates the last protected function called
and returns <b>message</b> as the error message.
Function <b>error</b> never returns.
Usually, <b>error</b> adds some information about the error position
at the beginning of the message.
The <b>level</b> argument specifies how to get the error position.
With level 1 (the default), the error position is where the
<b>error</b> function was called.
Level 2 points the error to where the function
that called <b>error</b> was called; and so on.
Passing a level 0 avoids the addition of error position information
to the message.
</reference>
</element>
<element pattern="_G">
<reference><span color="blue">A global variable (not a function) that</span>
holds the global environment (that is, <b>_G._G = _G</b>).
Lua itself does not use this variable;
changing its value does not affect any environment,
nor vice-versa.
(Use <b>setfenv</b> to change environments.)
</reference>
</element>
<element pattern="getfenv">
<reference><span color="blue">getfenv ([f])</span>
Returns the current environment in use by the function.
<b>f</b> can be a Lua function or a number
that specifies the function at that stack level:
Level 1 is the function calling <b>getfenv</b>.
If the given function is not a Lua function,
or if <b>f</b> is 0,
<b>getfenv</b> returns the global environment.
The default for <b>f</b> is 1.
</reference>
</element>
<element pattern="getmetatable">
<reference><span color="blue">getmetatable (object)</span>
If <b>object</b> does not have a metatable, returns <b>nil</b>.
Otherwise,
if the object's metatable has a <b>"__metatable"</b> field,
returns the associated value.
Otherwise, returns the metatable of the given object.
</reference>
</element>
<element pattern="ipairs">
<reference><span color="blue">ipairs (t)</span>
Returns three values: an iterator function, the table <b>t</b>, and 0,
so that the construction
     for i,v in ipairs(t) do <i>body</i> end
will iterate over the pairs (<b>1,t[1]</b>), (<b>2,t[2]</b>), ···,
up to the first integer key absent from the table.
</reference>
</element>
<element pattern="load">
<reference><span color="blue">load (func [, chunkname])</span>
Loads a chunk using function <b>func</b> to get its pieces.
Each call to <b>func</b> must return a string that concatenates
with previous results.
A return of an empty string, <b>nil</b>, or no value signals the end of the chunk.
If there are no errors, 
returns the compiled chunk as a function;
otherwise, returns <b>nil</b> plus the error message.
The environment of the returned function is the global environment.
<b>chunkname</b> is used as the chunk name for error messages
and debug information.
When absent,
it defaults to "<b>=(load)</b>".
</reference>
</element>
<element pattern="loadfile">
<reference><span color="blue">loadfile ([filename])</span>
Similar to <b>load</b>,
but gets the chunk from file <b>filename</b>
or from the standard input,
if no file name is given.
</reference>
</element>
<element pattern="loadstring">
<reference><span color="blue">loadstring (string [, chunkname]</span>
Similar to <b>load</b>,
but gets the chunk from the given string.
To load and run a given string, use the idiom
     assert(loadstring(s))()
When absent,
<b>chunkname</b> defaults to the given string.
</reference>
</element>
<element pattern="next">
<reference><span color="blue">next (table [, index])</span>
Allows a program to traverse all fields of a table.
Its first argument is a table and its second argument
is an index in this table.
<b>next</b> returns the next index of the table
and its associated value.
When called with <b>nil</b> as its second argument,
<b>next</b> returns an initial index
and its associated value.
When called with the last index,
or with <b>nil</b> in an empty table,
<b>next</b> returns <b>nil</b>.
If the second argument is absent, then it is interpreted as <b>nil</b>.
In particular,
you can use <b>next(t)</b> to check whether a table is empty.
The order in which the indices are enumerated is not specified,
<i>even for numeric indices</i>.
(To traverse a table in numeric order,
use a numerical <b>for</b> or the <b>ipairs</b> function.)
The behavior of <b>next</b> is <i>undefined</i> if,
during the traversal,
you assign any value to a non-existent field in the table.
You may however modify existing fields.
In particular, you may clear existing fields.
</reference>
</element>
<element pattern="pairs">
<reference><span color="blue">pairs (t)</span>
Returns three values: the <b>next</b> function, the table <b>t</b>, and <b>nil</b>,
so that the construction
     for k,v in pairs(t) do <i>body</i> end
will iterate over all key–value pairs of table <b>t</b>.
See function <b>next</b> for the caveats of modifying
the table during its traversal.
</reference>
</element>
<element pattern="pcall">
<reference><span color="blue">pcall (f, arg1, ···)</span>
Calls function <b>f</b> with
the given arguments in <i>protected mode</i>.
This means that any error inside <b>f</b> is not propagated;
instead, <b>pcall</b> catches the error
and returns a status code.
Its first result is the status code (a boolean),
which is true if the call succeeds without errors.
In such case, <b>pcall</b> also returns all results from the call,
after this first result.
In case of any error, <b>pcall</b> returns <b>false</b> plus the error message.
</reference>
</element>
<element pattern="print">
<reference><span color="blue">print (···)</span>
Receives any number of arguments,
and prints their values to <b>stdout</b>,
using the <b>tostring</b> function to convert them to strings.
<b>print</b> is not intended for formatted output,
but only as a quick way to show a value,
typically for debugging.
For formatted output, use <b>string.format</b>.
</reference>
</element>
<element pattern="rawequal">
<reference><span color="blue">rawequal (v1, v2)</span>
Checks whether <b>v1</b> is equal to <b>v2</b>,
without invoking any metamethod.
Returns a boolean.
</reference>
</element>
<element pattern="rawget">
<reference><span color="blue">rawget (table, index)</span>
Gets the real value of table[index], without invoking any metamethod. 
table must be a table; index may be any value. 
</reference>
</element>
<element pattern="rawset">
<reference><span color="blue">rawset (table, index, value)</span>
Sets the real value of <b>table[index]</b> to <b>value</b>,
without invoking any metamethod.
<b>table</b> must be a table,
<b>index</b> any value different from <b>nil</b>,
and <b>value</b> any Lua value.
This function returns <b>table</b>.
</reference>
</element>
<element pattern="select">
<reference><span color="blue">select (index, ···)</span>
If <b>index</b> is a number,
returns all arguments after argument number <b>index</b>.
Otherwise, <b>index</b> must be the string <b>"#"</b>,
and <b>select</b> returns the total number of extra arguments it received.
</reference>
</element>
<element pattern="setfenv">
<reference><span color="blue">setfenv (f, table)</span>
Sets the environment to be used by the given function.
<b>f</b> can be a Lua function or a number
that specifies the function at that stack level:
Level 1 is the function calling <b>setfenv</b>.
<b>setfenv</b> returns the given function.
As a special case, when <b>f</b> is 0 <b>setfenv</b> changes
the environment of the running thread.
In this case, <b>setfenv</b> returns no values.
</reference>
</element>
<element pattern="setmetatable">
<reference><span color="blue">setmetatable (table, metatable)</span>
Sets the metatable for the given table.
(You cannot change the metatable of other types from Lua, only from C.)
If <b>metatable</b> is <b>nil</b>,
removes the metatable of the given table.
If the original metatable has a <b>"__metatable"</b> field,
raises an error.
This function returns <b>table</b>.
</reference>
</element>
<element pattern="tonumber">
<reference><span color="blue">tonumber (e [, base])</span>
Tries to convert its argument to a number.
If the argument is already a number or a string convertible
to a number, then <b>tonumber</b> returns this number;
otherwise, it returns <b>nil</b>.
An optional argument specifies the base to interpret the numeral.
The base may be any integer between 2 and 36, inclusive.
In bases above 10, the letter '<b>A</b>' (in either upper or lower case)
represents 10, '<b>B</b>' represents 11, and so forth,
with '<b>Z</b>' representing 35.
In base 10 (the default), the number can have a decimal part,
as well as an optional exponent part (see §2.1).
In other bases, only unsigned integers are accepted.
</reference>
</element>
<element pattern="tostring">
<reference><span color="blue">tostring (e)</span>
Receives an argument of any type and
converts it to a string in a reasonable format.
For complete control of how numbers are converted,
use <b>string.format</b>.
If the metatable of <b>e</b> has a <b>"__tostring"</b> field,
then <b>tostring</b> calls the corresponding value
with <b>e</b> as argument,
and uses the result of the call as its result.
</reference>
</element>
<element pattern="type">
<reference><span color="blue">type (v)</span>
Returns the type of its only argument, coded as a string.
The possible results of this function are
"<b>nil</b>" (a string, not the value <b>nil</b>),
"<b>number</b>",
"<b>string</b>",
"<b>boolean</b>",
"<b>table</b>",
"<b>function</b>",
"<b>thread</b>",
and "<b>userdata</b>".
</reference>
</element>
<element pattern="unpack">
<reference><span color="blue">unpack (list [, i [, j]])</span>
Returns the elements from the given table.
This function is equivalent to
     return list[i], list[i+1], ···, list[j]
except that the above code can be written only for a fixed number
of elements.
By default, <b>i</b> is 1 and <b>j</b> is the length of the list,
as defined by the length operator (see §2.5.5).
</reference>
</element>
<element pattern="_VERSION">
<reference><span color="blue">_VERSION</span>
A global variable (not a function) that
holds a string containing the current interpreter version.
The current contents of this variable is "<b>Lua 5.1</b>".
</reference>
</element>
<element pattern="xpcall">
<reference><span color="blue">xpcall (f, err)</span>
This function is similar to <b>pcall</b>,
except that you can set a new error handler.
<b>xpcall</b> calls function <b>f</b> in protected mode,
using <b>err</b> as the error handler.
Any error inside <b>f</b> is not propagated;
instead, <b>xpcall</b> catches the error,
calls the <b>err</b> function with the original error object,
and returns a status code.
Its first result is the status code (a boolean),
which is true if the call succeeds without errors.
In this case, <b>xpcall</b> also returns all results from the call,
after this first result.
In case of any error,
<b>xpcall</b> returns <b>false</b> plus the result from <b>err</b>.
</reference>
</element>
<element pattern="string.byte">
<reference><span color="blue">string.byte (s [, i [, j]])</span>
Returns the internal numerical codes of the characters <b>s[i]</b>,
<b>s[i+1]</b>, ···, <b>s[j]</b>.
The default value for <b>i</b> is 1;
the default value for <b>j</b> is <b>i</b>.
Note that numerical codes are not necessarily portable across platforms.
</reference>
</element>
<element pattern="string.char">
<reference><span color="blue">string.char (···)</span>
Receives zero or more integers.
Returns a string with length equal to the number of arguments,
in which each character has the internal numerical code equal
to its corresponding argument.
Note that numerical codes are not necessarily portable across platforms.
</reference>
</element>
<element pattern="string.dump">
<reference><span color="blue">string.dump (function)</span>
Returns a string containing a binary representation of the given function,
so that a later <b>loadstring</b> on this string returns
a copy of the function.
<b>function</b> must be a Lua function without upvalues.
</reference>
</element>
<element pattern="string.find">
<reference><span color="blue">string.find (s, pattern [, init [, plain]])</span>
Looks for the first match of
<b>pattern</b> in the string <b>s</b>.
If it finds a match, then <b>find</b> returns the indices of <b>s</b>
where this occurrence starts and ends;
otherwise, it returns <b>nil</b>.
A third, optional numerical argument <b>init</b> specifies
where to start the search;
its default value is 1 and can be negative.
A value of <b>true</b> as a fourth, optional argument <b>plain</b>
turns off the pattern matching facilities,
so the function does a plain "find substring" operation,
with no characters in <b>pattern</b> being considered "magic".
Note that if <b>plain</b> is given, then <b>init</b> 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.
</reference>
</element>
<element pattern="string.format">
<reference><span color="blue">string.format (formatstring, ···)</span>
Returns a formatted version of its variable number of arguments
following the description given in its first argument (which must be a string).
The format string follows the same rules as the <b>printf</b> family of
standard C functions.
The only differences are that the options/modifiers
<b>*</b>, <b>l</b>, <b>L</b>, <b>n</b>, <b>p</b>,
and <b>h</b> are not supported
and that there is an extra option, <b>q</b>.
The <b>q</b> option formats a string in a form suitable to be safely read
back by the Lua interpreter:
the string is written between double quotes,
and all double quotes, newlines, embedded zeros,
and backslashes in the string
are correctly escaped when written.
For instance, the call
     string.format('%q', 'a string with "quotes" and \n new line')
will produce the string:
     "a string with \"quotes\" and \
      new line"
The options <b>c</b>, <b>d</b>, <b>E</b>, <b>e</b>, <b>f</b>,
<b>g</b>, <b>G</b>, <b>i</b>, <b>o</b>, <b>u</b>, <b>X</b>, and <b>x</b> all
expect a number as argument,
whereas <b>q</b> and <b>s</b> expect a string.
This function does not accept string values
containing embedded zeros,
except as arguments to the <b>q</b> option.
</reference>
</element>
<element pattern="string.gmatch">
<reference><span color="blue">string.gmatch (s, pattern)</span>
Returns an iterator function that,
each time it is called,
returns the next captures from <b>pattern</b> over string <b>s</b>.
If <b>pattern</b> specifies no captures,
then the whole match is produced in each call.
As an example, the following loop
     s = "hello world from Lua"
     for w in string.gmatch(s, "%a+") do
       print(w)
     end
will iterate over all the words from string <b>s</b>,
printing one per line.
</reference>
</element>
<element pattern="string.gsub">
<reference><span color="blue">string.gsub (s, pattern, repl [, n])</span>
Returns a copy of <b>s</b>
in which all (or the first <b>n</b>, if given)
occurrences of the <b>pattern</b> have been
replaced by a replacement string specified by <b>repl</b>,
which can be a string, a table, or a function.
<b>gsub</b> also returns, as its second value,
the total number of matches that occurred.
If <b>repl</b> is a string, then its value is used for replacement.
The character <b>%</b> works as an escape character:
any sequence in <b>repl</b> of the form <b>%<i>n</i></b>,
with <i>n</i> between 1 and 9,
stands for the value of the <i>n</i>-th captured substring (see below).
The sequence <b>%0</b> stands for the whole match.
The sequence <b>%%</b> stands for a single <b>%</b>.
If <b>repl</b> is a table, then the table is queried for every match,
using the first capture as the key;
if the pattern specifies no captures,
then the whole match is used as the key.
If <b>repl</b> is a function, then this function is called every time a
match occurs, with all captured substrings passed as arguments,
in order;
if the pattern specifies no captures,
then the whole match is passed as a sole argument.
If the value returned by the table query or by the function call
is a string or a number,
then it is used as the replacement string;
otherwise, if it is <b>false</b> or <b>nil</b>,
then there is no replacement
(that is, the original match is kept in the string).
</reference>
</element>
<element pattern="string.len">
<reference><span color="blue">string.len (s)</span>
Receives a string and returns its length.
The empty string <b>""</b> has length 0.
Embedded zeros are counted,
so <b>"a\000bc\000"</b> has length 5.
</reference>
</element>
<element pattern="string.lower">
<reference><span color="blue">string.lower (s)</span>
Receives a string and returns a copy of this string with all
uppercase letters changed to lowercase.
All other characters are left unchanged.
The definition of what an uppercase letter is depends on the current locale.
</reference>
</element>
<element pattern="string.match">
<reference><span color="blue">string.match (s, pattern [, init])</span>
Looks for the first <i>match</i> of
<b>pattern</b> in the string <b>s</b>.
If it finds one, then <b>match</b> returns
the captures from the pattern;
otherwise it returns <b>nil</b>.
If <b>pattern</b> specifies no captures,
then the whole match is returned.
A third, optional numerical argument <b>init</b> specifies
where to start the search;
its default value is 1 and can be negative.
</reference>
</element>
<element pattern="string.rep">
<reference><span color="blue">string.rep (s, n)</span>
Returns a string that is the concatenation of <b>n</b> copies of
the string <b>s</b>.
</reference>
</element>
<element pattern="string.reverse">
<reference><span color="blue">string.reverse (s)</span>
Returns a string that is the string <b>s</b> reversed.
</reference>
</element>
<element pattern="string.sub">
<reference><span color="blue">string.sub (s, i [, j])</span>
Returns the substring of <b>s</b> that
starts at <b>i</b>  and continues until <b>j</b>;
<b>i</b> and <b>j</b> can be negative.
If <b>j</b> is absent, then it is assumed to be equal to -1
(which is the same as the string length).
In particular,
the call <b>string.sub(s,1,j)</b> returns a prefix of <b>s</b>
with length <b>j</b>,
and <b>string.sub(s, -i)</b> returns a suffix of <b>s</b>
with length <b>i</b>.
</reference>
</element>
<element pattern="string.upper">
<reference><span color="blue">string.upper (s)</span>
Receives a string and returns a copy of this string with all
lowercase letters changed to uppercase.
All other characters are left unchanged.
The definition of what a lowercase letter is depends on the current locale.
<h3>5.4.1 - Patterns</h3>
<h4>Character Class:</h4>
A <i>character class</i> is used to represent a set of characters.
The following combinations are allowed in describing a character class:
<b><i>x</i>:</b>
(where <i>x</i> is not one of the <i>magic characters</i>
<b>^$()%.[]*+-?</b>)
represents the character <i>x</i> itself.
<b>.</b>: (a dot) represents all characters.
<b>%a</b>: represents all letters.
<b>%c</b>: represents all control characters.
<b>%d</b>: represents all digits.
<b>%l</b>: represents all lowercase letters.
<b>%p</b>: represents all punctuation characters.
<b>%s</b>: represents all space characters.
<b>%u</b>: represents all uppercase letters.
<b>%w</b>: represents all alphanumeric characters.
<b>%x</b>: represents all hexadecimal digits.
<b>%z</b>: represents the character with representation 0.
<b>%<i>x</i></b>: (where <i>x</i> is any non-alphanumeric character)
represents the character <i>x</i>.
This is the standard way to escape the magic characters.
Any punctuation character (even the non magic)
can be preceded by a '<b>%</b>'
when used to represent itself in a pattern.
<b>[<i>set</i>]</b>:
represents the class which is the union of all
characters in <i>set</i>.
A range of characters can be specified by
separating the end characters of the range with a '<b>-</b>'.
All classes <b>%</b><i>x</i> described above can also be used as
components in <i>set</i>.
All other characters in <i>set</i> represent themselves.
</reference>
</element>
<element pattern="table.concat">
<reference><span color="blue">table.concat (table [, sep [, i [, j]]])</span>
Given an array where all elements are strings or numbers,
returns <b>table[i]..sep..table[i+1] ··· sep..table[j]</b>.
The default value for <b>sep</b> is the empty string,
the default for <b>i</b> is 1,
and the default for <b>j</b> is the length of the table.
If <b>i</b> is greater than <b>j</b>, returns the empty string.
</reference>
</element>
<element pattern="table.insert">
<reference><span color="blue">table.insert (table, [pos,] value)</span>
Inserts element <b>value</b> at position <b>pos</b> in <b>table</b>,
shifting up other elements to open space, if necessary.
The default value for <b>pos</b> is <b>n+1</b>,
where <b>n</b> is the length of the table (see §2.5.5),
so that a call <b>table.insert(t,x)</b> inserts <b>x</b> at the end
of table <b>t</b>.
</reference>
</element>table.maxn (table)
<element pattern="table.maxn">
<reference><span color="blue">Returns the largest positive numerical index of the given table,</span>
or zero if the table has no positive numerical indices.
(To do its job this function does a linear traversal of
the whole table.) 
</reference>
</element>
<element pattern="table.remove">
<reference><span color="blue">table.remove (table [, pos])</span>
Removes from <b>table</b> the element at position <b>pos</b>,
shifting down other elements to close the space, if necessary.
Returns the value of the removed element.
The default value for <b>pos</b> is <b>n</b>,
where <b>n</b> is the length of the table,
so that a call <b>table.remove(t)</b> removes the last element
of table <b>t</b>.
</reference>
</element>
<element pattern="table.sort">
<reference><span color="blue">table.sort (table [, comp])</span>
Sorts table elements in a given order, <i>in-place</i>,
from <b>table[1]</b> to <b>table[n]</b>,
where <b>n</b> is the length of the table.
If <b>comp</b> 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 <b>not comp(a[i+1],a[i])</b> will be true after the sort).
If <b>comp</b> is not given,
then the standard Lua operator <b>&amp;lt;</b> 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.
</reference>
</element>
<element pattern="math.abs">
<reference><span color="blue">math.abs (x)</span>
Returns the absolute value of <b>x</b>.
</reference>
</element>
<element pattern="math.acos">
<reference><span color="blue">math.acos (x)</span>
Returns the arc cosine of <b>x</b> (in radians).
</reference>
</element>
<element pattern="math.asin">
<reference><span color="blue">math.asin (x)</span>
Returns the arc sine of <b>x</b> (in radians).
</reference>
</element>
<element pattern="math.atan">
<reference><span color="blue">math.atan (x)</span>
Returns the arc tangent of <b>x</b> (in radians).
</reference>
</element>
<element pattern="math.atan2">
<reference><span color="blue">math.atan2 (y, x)</span>
Returns the arc tangent of <b>y/x</b> (in radians),
but uses the signs of both parameters to find the
quadrant of the result.
(It also handles correctly the case of <b>x</b> being zero.)
</reference>
</element>
<element pattern="math.ceil">
<reference><span color="blue">math.ceil (x)</span>
Returns the smallest integer larger than or equal to <b>x</b>.
</reference>
</element>
<element pattern="math.cos">
<reference><span color="blue">math.cos (x)</span>
Returns the cosine of <b>x</b> (assumed to be in radians).
</reference>
</element>
<element pattern="math.cosh">
<reference><span color="blue">math.cosh (x)</span>
Returns the hyperbolic cosine of <b>x</b>.
</reference>
</element>
<element pattern="math.deg">
<reference><span color="blue">math.deg (x)</span>
Returns the angle <b>x</b> (given in radians) in degrees.
</reference>
</element>
<element pattern="math.exp">
<reference><span color="blue">math.exp (x)</span>
Returns the value <i>e<sup>x</sup></i>.
</reference>
</element>
<element pattern="math.floor">
<reference><span color="blue">math.floor (x)</span>
Returns the largest integer smaller than or equal to <b>x</b>.
</reference>
</element>
<element pattern="math.fmod">
<reference><span color="blue">math.fmod (x, y)</span>
Returns the remainder of the division of <b>x</b> by <b>y</b>
that rounds the quotient towards zero.
</reference>
</element>
<element pattern="math.frexp">
<reference><span color="blue">math.frexp (x)</span>
Returns <b>m</b> and <b>e</b> such that <i>x = m2<sup>e</sup></i>,
<b>e</b> is an integer and the absolute value of <b>m</b> is
in the range <i>[0.5, 1)</i>
(or zero when <b>x</b> is zero).
</reference>
</element>
<element pattern="math.ldexp">
<reference><span color="blue">math.ldexp (m, e)</span>
Returns <i>m2<sup>e</sup></i> (<b>e</b> should be an integer).
</reference>
</element>
<element pattern="math.log">
<reference><span color="blue">math.log (x)</span>
Returns the natural logarithm of <b>x</b>.
</reference>
</element>
<element pattern="math.log10">
<reference><span color="blue">math.log10 (x)</span>
Returns the base-10 logarithm of <b>x</b>.
</reference>
</element>
<element pattern="math.max">
<reference><span color="blue">math.max (x, ···)</span>
Returns the maximum value among its arguments.
</reference>
</element>
<element pattern="math.min">
<reference><span color="blue">math.min (x, ···)</span>
Returns the minimum value among its arguments.
</reference>
</element>
<element pattern="math.modf">
<reference><span color="blue">math.modf (x)</span>
Returns two numbers,
the integral part of <b>x</b> and the fractional part of <b>x</b>.
</reference>
</element>
<element pattern="math.pow">
<reference><span color="blue">Returns <i>x<sup>y</sup></i>.</span>
(You can also use the expression <b>x^y</b> to compute this value.)
</reference>
</element>
<element pattern="math.rad">
<reference><span color="blue">math.rad (x)</span>
Returns the angle <b>x</b> (given in degrees) in radians.
</reference>
</element>
<element pattern="math.random">
<reference><span color="blue">This function is an interface to the simple</span>
pseudo-random generator function <b>rand</b> provided by ANSI C.
(No guarantees can be given for its statistical properties.)
When called without arguments,
returns a uniform pseudo-random real number
in the range <i>[0,1)</i>.  
When called with an integer number <b>m</b>,
<b>math.random</b> returns
a uniform pseudo-random integer in the range <i>[1, m]</i>.
When called with two integer numbers <b>m</b> and <b>n</b>,
<b>math.random</b> returns a uniform pseudo-random
integer in the range <i>[m, n]</i>.
</reference>
</element>
<element pattern="math.randomseed">
<reference><span color="blue">math.randomseed (x)</span>
Sets <b>x</b> as the "seed"
for the pseudo-random generator:
equal seeds produce equal sequences of numbers.
</reference>
</element>
<element pattern="math.sin">
<reference><span color="blue">math.sin (x)</span>
Returns the sine of <b>x</b> (assumed to be in radians).
</reference>
</element>
<element pattern="math.sinh">
<reference><span color="blue">math.sinh (x)</span>
Returns the hyperbolic sine of <b>x</b>.
</reference>
</element>
<element pattern="math.sqrt">
<reference><span color="blue">math.sqrt (x)</span>
Returns the square root of <b>x</b>.
(You can also use the expression <b>x^0.5</b> to compute this value.)
</reference>
</element>
<element pattern="math.tan">
<reference><span color="blue">Returns the tangent of <b>x</b> (assumed to be in radians).</span>
</reference>
</element>
<element pattern="math.tanh">
<reference><span color="blue">math.tanh (x)</span>
Returns the hyperbolic tangent of <b>x</b>.
</reference>
</element>
<element pattern="io.close">
<reference><span color="blue">io.close ([file])</span>
Equivalent to <b>file:close()</b>.
Without a <b>file</b>, closes the default output file.
</reference>
</element>
<element pattern="io.flush">
<reference><span color="blue">io.flush ()</span>
Equivalent to <b>file:flush</b> over the default output file.
</reference>
</element>
<element pattern="io.input">
<reference><span color="blue">io.input ([file])</span>
When called with a file name, it opens the named file (in text mode),
and sets its handle as the default input file.
When called with a file handle,
it simply sets this file handle as the default input file.
When called without parameters,
it returns the current default input file.
In case of errors this function raises the error,
instead of returning an error code.
</reference>
</element>
<element pattern="io.lines">
<reference><span color="blue">io.lines ([filename])</span>
Opens the given file name in read mode
and returns an iterator function that,
each time it is called,
returns a new line from the file.
Therefore, the construction
     for line in io.lines(filename) do <i>body</i> end
will iterate over all lines of the file.
When the iterator function detects the end of file,
it returns <b>nil</b> (to finish the loop) and automatically closes the file.
The call <b>io.lines()</b> (with no file name) is equivalent
to <b>io.input():lines()</b>;
that is, it iterates over the lines of the default input file.
In this case it does not close the file when the loop ends.
</reference>
</element>
<element pattern="io.open">
<reference><span color="blue">io.open (filename [, mode])</span>
This function opens a file,
in the mode specified in the string <b>mode</b>.
It returns a new file handle,
or, in case of errors, <b>nil</b> plus an error message.
The <b>mode</b> string can be any of the following:
<b>"r":</b> read mode (the default);
<b>"w":</b> write mode;
<b>"a":</b> append mode;
<b>"r+":</b> update mode, all previous data is preserved;
<b>"w+":</b> update mode, all previous data is erased;
<b>"a+":</b> append update mode, previous data is preserved,
  writing is only allowed at the end of file.
The <b>mode</b> string can also have a '<b>b</b>' at the end,
which is needed in some systems to open the file in binary mode.
This string is exactly what is used in the
standard C function <b>fopen</b>.
</reference>
</element>
<element pattern="io.output">
<reference><span color="blue">io.output ([file])</span>
Similar to <b>io.input</b>, but operates over the default output file.
</reference>
</element>
<element pattern="io.popen">
<reference><span color="blue">io.popen (prog [, mode])</span>
Starts program <b>prog</b> in a separated process and returns
a file handle that you can use to read data from this program
(if <b>mode</b> is <b>"r"</b>, the default)
or to write data to this program
(if <b>mode</b> is <b>"w"</b>).
This function is system dependent and is not available
on all platforms.
</reference>
</element>
<element pattern="io.read">
<reference><span color="blue">io.read (···)</span>
Equivalent to <b>io.input():read</b>.
</reference>
</element>
<element pattern="io.tmpfile">
<reference><span color="blue">io.tmpfile ()</span>
Returns a handle for a temporary file.
This file is opened in update mode
and it is automatically removed when the program ends.
</reference>
</element>
<element pattern="io.type">
<reference><span color="blue">io.type (obj)</span>
Checks whether <b>obj</b> is a valid file handle.
Returns the string <b>"file"</b> if <b>obj</b> is an open file handle,
<b>"closed file"</b> if <b>obj</b> is a closed file handle,
or <b>nil</b> if <b>obj</b> is not a file handle.
</reference>
</element>
<element pattern="io.write">
<reference><span color="blue">io.write (···)</span>
Equivalent to <b>io.output():write</b>.
</reference>
</element>
<element pattern="file:close">
<reference><span color="blue">file:close ()</span>
Closes <b>file</b>.
Note that files are automatically closed when
their handles are garbage collected,
but that takes an unpredictable amount of time to happen.
</reference>
</element>
<element pattern="file:flush">
<reference><span color="blue">file:flush ()</span>
Saves any written data to <b>file</b>.
</reference>
</element>
<element pattern="file:lines">
<reference><span color="blue">file:lines ()</span>
Returns an iterator function that,
each time it is called,
returns a new line from the file.
Therefore, the construction
     for line in file:lines() do <i>body</i> end
will iterate over all lines of the file.
(Unlike <b>io.lines</b>, this function does not close the file
when the loop ends.)
</reference>
</element>
<element pattern="file:read">
<reference><span color="blue">file:read (···)</span>
Reads the file <b>file</b>,
according to the given formats, which specify what to read.
For each format,
the function returns a string (or a number) with the characters read,
or <b>nil</b> if it cannot read data with the specified format.
When called without formats,
it uses a default format that reads the entire next line
(see below).
The available formats are
<b>"*n":</b>
reads a number;
this is the only format that returns a number instead of a string.
<b>"*a":</b>
reads the whole file, starting at the current position.
On end of file, it returns the empty string.
<b>"*l":</b>
reads the next line (skipping the end of line),
returning <b>nil</b> on end of file.
This is the default format.
<b><i>number</i>:</b>
reads a string with up to this number of characters,
returning <b>nil</b> on end of file.
If number is zero,
it reads nothing and returns an empty string,
or <b>nil</b> on end of file.
</reference>
</element>
<element pattern="file:seek">
<reference><span color="blue">file:seek ([whence] [, offset])</span>
Sets and gets the file position,
measured from the beginning of the file,
to the position given by <b>offset</b> plus a base
specified by the string <b>whence</b>, as follows:
<b>"set":</b> base is position 0 (beginning of the file);
<b>"cur":</b> base is current position;
<b>"end":</b> base is end of file;
In case of success, function <b>seek</b> returns the final file position,
measured in bytes from the beginning of the file.
If this function fails, it returns <b>nil</b>,
plus a string describing the error.
The default value for <b>whence</b> is <b>"cur"</b>,
and for <b>offset</b> is 0.
Therefore, the call <b>file:seek()</b> returns the current
file position, without changing it;
the call <b>file:seek("set")</b> sets the position to the
beginning of the file (and returns 0);
and the call <b>file:seek("end")</b> sets the position to the
end of the file, and returns its size.
</reference>
</element>
<element pattern="file:setvbuf">
<reference><span color="blue">file:setvbuf (mode [, size])</span>
Sets the buffering mode for an output file.
There are three available modes:
<b>"no":</b>
no buffering; the result of any output operation appears immediately.
<b>"full":</b>
full buffering; output operation is performed only
when the buffer is full (or when you explicitly <b>flush</b> the file
(see <b>io.flush</b>)).
<b>"line":</b>
line buffering; output is buffered until a newline is output
or there is any input from some special files
(such as a terminal device).
For the last two cases, <b>size</b>
specifies the size of the buffer, in bytes.
The default is an appropriate size.
</reference>
</element>
<element pattern="file:write">
<reference><span color="blue">file:write (··</span>
Writes the value of each of its arguments to
the <b>file</b>.
The arguments must be strings or numbers.
To write other values,
use <b>tostring</b> or <b>string.format</b> before <b>write</b>.
</reference>
</element>
<element pattern="os.clock">
<reference><span color="blue">os.clock ()</span>
Returns an approximation of the amount in seconds of CPU time
used by the program.
</reference>
</element>
<element pattern="os.date">
<reference><span color="blue">os.date ([format [, time]])</span>
Returns a string or a table containing date and time,
formatted according to the given string <b>format</b>.
If the <b>time</b> argument is present,
this is the time to be formatted
(see the <b>os.time</b> function for a description of this value).
Otherwise, <b>date</b> formats the current time.
If <b>format</b> starts with '<b>!</b>',
then the date is formatted in Coordinated Universal Time.
After this optional character,
if <b>format</b> is the string "<b>*t</b>",
then <b>date</b> returns a table with the following fields:
<b>year</b> (four digits), <b>month</b> (1--12), <b>day</b> (1--31),
<b>hour</b> (0--23), <b>min</b> (0--59), <b>sec</b> (0--61),
<b>wday</b> (weekday, Sunday is 1),
<b>yday</b> (day of the year),
and <b>isdst</b> (daylight saving flag, a boolean).
If <b>format</b> is not "<b>*t</b>",
then <b>date</b> returns the date as a string,
formatted according to the same rules as the C function <b>strftime</b>.
When called without arguments,
<b>date</b> returns a reasonable date and time representation that depends on
the host system and on the current locale
(that is, <b>os.date()</b> is equivalent to <b>os.date("%c")</b>).
</reference>
</element>
<element pattern="os.difftime">
<reference><span color="blue">os.difftime (t2, t1)</span>
Returns the number of seconds from time <b>t1</b> to time <b>t2</b>.
In POSIX, Windows, and some other systems,
this value is exactly <b>t2</b><i>-</i><b>t1</b>.
</reference>
</element>
<element pattern="os.execute">
<reference><span color="blue">os.execute ([command])</span>
This function is equivalent to the C function <b>system</b>.
It passes <b>command</b> to be executed by an operating system shell.
It returns a status code, which is system-dependent.
If <b>command</b> is absent, then it returns nonzero if a shell is available
and zero otherwise.
</reference>
</element>
<element pattern="os.exit">
<reference><span color="blue">os.exit ([code])</span>
Calls the C function <b>exit</b>,
with an optional <b>code</b>,
to terminate the host program.
The default value for <b>code</b> is the success code.
</reference>
</element>
<element pattern="os.getenv">
<reference><span color="blue">os.getenv (varname)</span>
Returns the value of the process environment variable <b>varname</b>,
or <b>nil</b> if the variable is not defined.
</reference>
</element>
<element pattern="os.remove">
<reference><span color="blue">os.remove (filename)</span>
Deletes the file or directory with the given name.
Directories must be empty to be removed.
If this function fails, it returns <b>nil</b>,
plus a string describing the error.
</reference>
</element>
<element pattern="os.rename">
<reference><span color="blue">os.rename (oldname, newname)</span>
Renames file or directory named <b>oldname</b> to <b>newname</b>.
If this function fails, it returns <b>nil</b>,
plus a string describing the error.
</reference>
</element>
<element pattern="os.setlocale">
<reference><span color="blue">os.setlocale (locale [, category])</span>
Sets the current locale of the program.
<b>locale</b> is a string specifying a locale;
<b>category</b> is an optional string describing which category to change:
<b>"all"</b>, <b>"collate"</b>, <b>"ctype"</b>,
<b>"monetary"</b>, <b>"numeric"</b>, or <b>"time"</b>;
the default category is <b>"all"</b>.
The function returns the name of the new locale,
or <b>nil</b> if the request cannot be honored.
If <b>locale</b> is the empty string,
the current locale is set to an implementation-defined native locale.
If <b>locale</b> is the string "<b>C</b>",
the current locale is set to the standard C locale.
When called with <b>nil</b> as the first argument,
this function only returns the name of the current locale
for the given category.
</reference>
</element>
<element pattern="os.time">
<reference><span color="blue">os.time ([table])</span>
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 <b>year</b>, <b>month</b>, and <b>day</b>,
and may have fields <b>hour</b>, <b>min</b>, <b>sec</b>, and <b>isdst</b>
(for a description of these fields, see the <b>os.date</b> 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 <b>time</b> can be used only as an argument to
<b>date</b> and <b>difftime</b>.
</reference>
</element>
<element pattern="os.tmpname">
<reference><span color="blue">os.tmpname ()</span>
Returns a string with a file name that can
be used for a temporary file.
The file must be explicitly opened before its use
and explicitly removed when no longer needed.
On some systems (POSIX),
this function also creates a file with that name,
to avoid security risks.
(Someone else might create the file with wrong permissions
in the time between getting the name and creating the file.)
You still have to open the file to use it
and to remove it (even if you do not use it).
When possible,
you may prefer to use <b>io.tmpfile</b>,
which automatically removes the file when the program ends.
</reference>
</element>
<element pattern="debug.debug">
<reference><span color="blue">debug.debug ()</span>
Enters an interactive mode with the user,
running each string that the user enters.
Using simple commands and other debug facilities,
the user can inspect global and local variables,
change their values, evaluate expressions, and so on.
A line containing only the word <b>cont</b> finishes this function,
so that the caller continues its execution.
Note that commands for <b>debug.debug</b> are not lexically nested
within any function, and so have no direct access to local variables.
</reference>
</element>
<element pattern="debug.getfenv">
<reference><span color="blue">debug.getfenv (o)</span>
Returns the environment of object <b>o</b>.
</reference>
</element>
<element pattern="debug.gethook">
<reference><span color="blue">debug.gethook ([thread])</span>
Returns the current hook settings of the thread, as three values:
the current hook function, the current hook mask,
and the current hook count
(as set by the <b>debug.sethook</b> function).
</reference>
</element>
<element pattern="debug.getinfo">
<reference><span color="blue">debug.getinfo ([thread,] function [, what])</span>
Returns a table with information about a function.
You can give the function directly,
or you can give a number as the value of <b>function</b>,
which means the function running at level <b>function</b> of the call stack
of the given thread:
level 0 is the current function (<b>getinfo</b> itself);
level 1 is the function that called <b>getinfo</b>;
and so on.
If <b>function</b> is a number larger than the number of active functions,
then <b>getinfo</b> returns <b>nil</b>.
The returned table can contain all the fields returned by <b>lua_getinfo</b>,
with the string <b>what</b> describing which fields to fill in.
The default for <b>what</b> is to get all information available,
except the table of valid lines.
If present,
the option '<b>f</b>'
adds a field named <b>func</b> with the function itself.
If present,
the option '<b>L</b>'
adds a field named <b>activelines</b> with the table of
valid lines.
For instance, the expression <b>debug.getinfo(1,"n").name</b> returns
a table with a name for the current function,
if a reasonable name can be found,
and the expression <b>debug.getinfo(print)</b>
returns a table with all available information
about the <b>print</b> function.
</reference>
</element>
<element pattern="debug.getlocal">
<reference><span color="blue">debug.getlocal ([thread,] level, local)</span>
This function returns the name and the value of the local variable
with index <b>local</b> of the function at level <b>level</b> of the stack.
(The first parameter or local variable has index 1, and so on,
until the last active local variable.)
The function returns <b>nil</b> if there is no local
variable with the given index,
and raises an error when called with a <b>level</b> out of range.
(You can call <b>debug.getinfo</b> to check whether the level is valid.)
Variable names starting with '<b>(</b>' (open parentheses)
represent internal variables
(loop control variables, temporaries, and C function locals).
</reference>
</element>
<element pattern="debug.getmetatable">
<reference><span color="blue">debug.getmetatable (object)</span>
Returns the metatable of the given <b>object</b>
or <b>nil</b> if it does not have a metatable.
</reference>
</element>
<element pattern="debug.getregistry">
<reference><span color="blue">debug.getregistry ()</span>
Returns the registry table (see §3.5).
</reference>
</element>
<element pattern="debug.getupvalue">
<reference><span color="blue">debug.getupvalue (func, up)</span>
This function returns the name and the value of the upvalue
with index <b>up</b> of the function <b>func</b>.
The function returns <b>nil</b> if there is no upvalue with the given index.
</reference>
</element>
<element pattern="debug.setfenv">
<reference><span color="blue">debug.setfenv (object, table)</span>
Sets the environment of the given <b>object</b> to the given <b>table</b>.
Returns <b>object</b>.
</reference>
</element>
<element pattern="debug.sethook">
<reference><span color="blue">debug.sethook ([thread,] hook, mask [, count])</span>
Sets the given function as a hook.
The string <b>mask</b> and the number <b>count</b> describe
when the hook will be called.
The string mask may have the following characters,
with the given meaning:
<b>"c"</b>: the hook is called every time Lua calls a function;
<b>"r"</b>: the hook is called every time Lua returns from a function;
<b>"l"</b>: the hook is called every time Lua enters a new line of code.
With a <b>count</b> different from zero,
the hook is called after every <b>count</b> instructions.
When called without arguments,
<b>debug.sethook</b> turns off the hook.
When the hook is called, its first parameter is a string
describing the event that has triggered its call:
<b>"call"</b>, <b>"return"</b> (or <b>"tail return"</b>,
when simulating a return from a tail call),
<b>"line"</b>, and <b>"count"</b>.
For line events,
the hook also gets the new line number as its second parameter.
Inside a hook,
you can call <b>getinfo</b> with level 2 to get more information about
the running function
(level 0 is the <b>getinfo</b> function,
and level 1 is the hook function),
unless the event is <b>"tail return"</b>.
In this case, Lua is only simulating the return,
and a call to <b>getinfo</b> will return invalid data.
</reference>
</element>
<element pattern="debug.setlocal">
<reference><span color="blue">debug.setlocal ([thread,] level, local, value)</span>
This function assigns the value <b>value</b> to the local variable
with index <b>local</b> of the function at level <b>level</b> of the stack.
The function returns <b>nil</b> if there is no local
variable with the given index,
and raises an error when called with a <b>level</b> out of range.
(You can call <b>getinfo</b> to check whether the level is valid.)
Otherwise, it returns the name of the local variable.
</reference>
</element>
<element pattern="debug.setmetatable">
<reference><span color="blue">debug.setmetatable (object, table)</span>
Sets the metatable for the given <b>object</b> to the given <b>table</b>
(which can be <b>nil</b>).
</reference>
</element>
<element pattern="debug.setupvalue">
<reference><span color="blue">debug.setupvalue (func, up, value)</span>
This function assigns the value <b>value</b> to the upvalue
with index <b>up</b> of the function <b>func</b>.
The function returns <b>nil</b> if there is no upvalue
with the given index.
Otherwise, it returns the name of the upvalue.
</reference>
</element>
<element pattern="debug.traceback">
<reference><span color="blue">debug.traceback ([thread,] [message] [, level])</span>
Returns a string with a traceback of the call stack.
An optional <b>message</b> string is appended
at the beginning of the traceback.
An optional <b>level</b> number tells at which level
to start the traceback
(default is 1, the function calling <b>traceback</b>).
</reference>
</element>
</group>

<group highlight="type" >
	<autocomplete enable="1" />
<element pattern="lua_Alloc">
<reference><i>typedef void * (*lua_Alloc) (void *ud,
                             void *ptr,
                             size_t osize,
                             size_t nsize);</i>
The type of the memory-allocation function used by Lua states.
The allocator function must provide a
functionality similar to <b>realloc</b>,
but not exactly the same.
Its arguments are
<b>ud</b>, an opaque pointer passed to <b>lua_newstate</b>;
<b>ptr</b>, a pointer to the block being allocated/reallocated/freed;
<b>osize</b>, the original size of the block;
<b>nsize</b>, the new size of the block.
<b>ptr</b> is <b>NULL</b> if and only if <b>osize</b> is zero.
When <b>nsize</b> is zero, the allocator must return <b>NULL</b>;
if <b>osize</b> is not zero,
it should free the block pointed to by <b>ptr</b>.
When <b>nsize</b> is not zero, the allocator returns <b>NULL</b>
if and only if it cannot fill the request.
When <b>nsize</b> is not zero and <b>osize</b> is zero,
the allocator should behave like <b>malloc</b>.
When <b>nsize</b> and <b>osize</b> are not zero,
the allocator behaves like <b>realloc</b>.
Lua assumes that the allocator never fails when
<b>osize &amp;gt;= nsize</b>.
</reference>
</element>
<element pattern="lua_CFunction">
<reference><i>typedef int (*lua_CFunction) (lua_State *L);</i>
Type for C functions.
In order to communicate properly with Lua,
a C function must use the following protocol,
which defines the way parameters and results are passed:
a C function receives its arguments from Lua in its stack
in direct order (the first argument is pushed first).
So, when the function starts,
<b>lua_gettop(L)</b> returns the number of arguments received by the function.
The first argument (if any) is at index 1
and its last argument is at index <b>lua_gettop(L)</b>.
To return values to Lua, a C function just pushes them onto the stack,
in direct order (the first result is pushed first),
and returns the number of results.
Any other value in the stack below the results will be properly
discarded by Lua.
Like a Lua function, a C function called by Lua can also return
many results.
</reference>
</element>
<element pattern="lua_Integer">
<reference><i>typedef ptrdiff_t lua_Integer;</i>
The type used by the Lua API to represent integral values.
By default it is a <b>ptrdiff_t</b>,
which is usually the largest signed integral type the machine handles
"comfortably".
</reference>
</element>
<element pattern="lua_Number">
<reference><i>typedef double lua_Number;</i>
The type of numbers in Lua.
By default, it is double, but that can be changed in <b>luaconf.h</b>.
Through the configuration file you can change
Lua to operate with another type for numbers (e.g., float or long).
</reference>
</element>
<element pattern="lua_Reader">
<reference><i>typedef const char * (*lua_Reader) (lua_State *L,
                                    void *data,
                                    size_t *size);</i>
The reader function used by <b>lua_load</b>.
Every time it needs another piece of the chunk,
<b>lua_load</b> calls the reader,
passing along its <b>data</b> parameter.
The reader must return a pointer to a block of memory
with a new piece of the chunk
and set <b>size</b> to the block size.
The block must exist until the reader function is called again.
To signal the end of the chunk,
the reader must return <b>NULL</b> or set <b>size</b> to zero.
The reader function may return pieces of any size greater than zero.
</reference>
</element>
<element pattern="lua_State">
<reference><i>typedef struct lua_State lua_State;</i>
Opaque structure that keeps the whole state of a Lua interpreter.
The Lua library is fully reentrant:
it has no global variables.
All information about a state is kept in this structure.
A pointer to this state must be passed as the first argument to
every function in the library, except to <b>lua_newstate</b>,
which creates a Lua state from scratch.
</reference>
</element>
<element pattern="lua_Writer">
<reference><i>typedef int (*lua_Writer) (lua_State *L,
                           const void* p,
                           size_t sz,
                           void* ud);</i>
The type of the writer function used by <b>lua_dump</b>.
Every time it produces another piece of chunk,
<b>lua_dump</b> calls the writer,
passing along the buffer to be written (<b>p</b>),
its size (<b>sz</b>),
and the <b>data</b> parameter supplied to <b>lua_dump</b>.
The writer returns an error code:
0 means no errors;
any other value means an error and stops <b>lua_dump</b> from
calling the writer again.
</reference>
</element>
<element pattern="lua_Debug">
<reference><i>typedef struct lua_Debug {
  int event;
  const char *name;           /* (n) */
  const char *namewhat;       /* (n) */
  const char *what;           /* (S) */
  const char *source;         /* (S) */
  int currentline;            /* (l) */
  int nups;                   /* (u) number of upvalues */
  int linedefined;            /* (S) */
  int lastlinedefined;        /* (S) */
  char short_src[LUA_IDSIZE]; /* (S) */
  /* private part */
  <i>other fields</i>
} lua_Debug;</i>
A structure used to carry different pieces of
information about an active function.
<b>lua_getstack</b> fills only the private part
of this structure, for later use.
To fill the other fields of <b>lua_Debug</b> with useful information,
call <b>lua_getinfo</b>.
The fields of <b>lua_Debug</b> have the following meaning:
<b>source</b>:
If the function was defined in a string,
then <b>source</b> is that string.
If the function was defined in a file,
then <b>source</b> starts with a '<b>@</b>' followed by the file name.
<b>short_src</b>:
a "printable" version of <b>source</b>, to be used in error messages.
<b>linedefined</b>:
the line number where the definition of the function starts.
<b>lastlinedefined</b>:
the line number where the definition of the function ends.
<b>what</b>:
the string <b>"Lua"</b> if the function is a Lua function,
<b>"C"</b> if it is a C function,
<b>"main"</b> if it is the main part of a chunk,
and <b>"tail"</b> if it was a function that did a tail call.
In the latter case,
Lua has no other information about the function.
<b>currentline</b>:
the current line where the given function is executing.
When no line information is available,
<b>currentline</b> is set to -1.
<b>name</b>:
a reasonable name for the given function.
Because functions in Lua are first-class values,
they do not have a fixed name:
some functions can be the value of multiple global variables,
while others can be stored only in a table field.
The <b>lua_getinfo</b> function checks how the function was
called to find a suitable name.
If it cannot find a name,
then <b>name</b> is set to <b>NULL</b>.
<b>namewhat</b>:
explains the <b>name</b> field.
The value of <b>namewhat</b> can be
<b>"global"</b>, <b>"local"</b>, <b>"method"</b>,
<b>"field"</b>, <b>"upvalue"</b>, or <b>""</b> (the empty string),
according to how the function was called.
(Lua uses the empty string when no other option seems to apply.)
<b>nups</b>:
the number of upvalues of the function.
</reference>
</element>
<element pattern="lua_Hook">
<reference><i>typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);</i>
Type for debugging hook functions.
Whenever a hook is called, its <b>ar</b> argument has its field
<b>event</b> set to the specific event that triggered the hook.
Lua identifies these events with the following constants:
<b>LUA_HOOKCALL</b>, <b>LUA_HOOKRET</b>,
<b>LUA_HOOKTAILRET</b>, <b>LUA_HOOKLINE</b>,
and <b>LUA_HOOKCOUNT</b>.
Moreover, for line events, the field <b>currentline</b> is also set.
To get the value of any other field in <b>ar</b>,
the hook must call <b>lua_getinfo</b>.
For return events, <b>event</b> can be <b>LUA_HOOKRET</b>,
the normal value, or <b>LUA_HOOKTAILRET</b>.
In the latter case, Lua is simulating a return from
a function that did a tail call;
in this case, it is useless to call <b>lua_getinfo</b>.
While Lua is running a hook, it disables other calls to hooks.
Therefore, if a hook calls back Lua to execute a function or a chunk,
this execution occurs without any calls to hooks.
</reference>
</element>
<element pattern="luaL_Reg">
<reference><i>typedef struct luaL_Reg {
  const char *name;
  lua_CFunction func;
} luaL_Reg;</i>
Type for arrays of functions to be registered by
<b>luaL_register</b>.
<b>name</b> is the function name and <b>func</b> is a pointer to
the function.
Any array of <b>luaL_Reg</b> must end with an sentinel entry
in which both <b>name</b> and <b>func</b> are <b>NULL</b>.
</reference>
</element>
<element pattern="luaL_Buffer">
<reference><i>typedef struct luaL_Buffer luaL_Buffer;</i>
Type for a <i>string buffer</i>.
A string buffer allows C code to build Lua strings piecemeal.
Its pattern of use is as follows:
First you declare a variable <b>b</b> of type <b>luaL_Buffer</b>.
Then you initialize it with a call <b>luaL_buffinit(L, &amp;b)</b>.
Then you add string pieces to the buffer calling any of
the <b>luaL_add*</b> functions.
You finish by calling <b>luaL_pushresult(&amp;b)</b>.
This call leaves the final string on the top of the stack.
</reference>
</element>
<element pattern="math.huge">
<reference>The value <b>HUGE_VAL</b>,
a value larger than or equal to any other numerical value.
</reference>
</element>
<element pattern="math.pi">
<reference>The value of <b>pi</b>.
</reference>
</element>
</group>

<element pattern="&#34;" highlight="string">
	<context symbols="\&#34;nrt" highlight="string">
		<element pattern="\\." is_regex="1" highlight="string" />
		<element pattern="&#34;" highlight="string" ends_context="1" />
	</context>
</element>
<element pattern="'" highlight="string">
	<context symbols="\'" highlight="string" >
		<element pattern="\\." is_regex="1" highlight="string" />
		<element pattern="'" highlight="string" ends_context="1" />
	</context>
</element>

<element pattern="[[" highlight="string">
	<context symbols="\]" highlight="string" >
		<element pattern="\\." is_regex="1" highlight="string" />
		<element pattern="]]" highlight="string" ends_context="1" />
	</context>
</element>
<element pattern="[=[" highlight="string">
	<context symbols="\]" highlight="string" >
		<element pattern="\\." is_regex="1" highlight="string" />
		<element pattern="]=]" highlight="string" ends_context="1" />
	</context>
</element>
<element pattern="[==[" highlight="string">
	<context symbols="\]" highlight="string" >
		<element pattern="\\." is_regex="1" highlight="string" />
		<element pattern="]==]" highlight="string" ends_context="1" />
	</context>
</element>
<element pattern="[===[" highlight="string">
	<context symbols="\]" highlight="string" >
		<element pattern="\\." is_regex="1" highlight="string" />
		<element pattern="]===]" highlight="string" ends_context="1" />
	</context>
</element>



<element id="e.lbrace" pattern="{" starts_block="1" mayfold="1" highlight="brackets" />
<element pattern="}" ends_block="1" blockstartelement="e.lbrace" highlight="brackets" />
<element id="e.lparen" pattern="(" starts_block="1" mayfold="1" highlight="brackets" block_name="Parentheses block" />
<element pattern=")" ends_block="1" blockstartelement="e.lparen" highlight="brackets" />

<element id="e.bcomment" pattern="--[[" starts_block="1" highlight="comment">
	<context symbols="][&#9;&#10;&#13;" highlight="comment" >
 		<element id="e.bbcomment" pattern="[" starts_block="1" highlight="comment">
			<context symbols="]" highlight="comment" >
				<element pattern="]" ends_block="1" blockstartelement="e.bbcomment" highlight="comment" mayfold="1" ends_context="1" />
				
			</context>
		</element>
		<element pattern="]]" ends_block="1" blockstartelement="e.bcomment" highlight="comment" mayfold="1" ends_context="1" />
	</context>
</element>
<element pattern="-- " highlight="comment"> 
	<context symbols="&#10;&#13;" highlight="comment">
		<element pattern="(&#10;|&#13;|&#13;&#10;)" is_regex="1" ends_context="1" />
	</context>
</element>
<element pattern="[0-9]+\.[0-9]+" is_regex="1" highlight="value" />
<element pattern="-[0-9]+\.[0-9]+" is_regex="1" highlight="value" />
<element pattern="0[xX][0-9a-fA-F][0-9a-fA-F]*" is_regex="1" highlight="value" /> 
<element pattern="-0[xX][0-9a-fA-F][0-9a-fA-F]*" is_regex="1" highlight="value" /> 
<!-- is 0X used in Lua? -->
<element pattern="-[0-9]\.[0-9]+(e|E)-?[0-9]+" is_regex="1" highlight="value" />
<element pattern="[0-9]\.[0-9]+(e|E)-?[0-9]+" is_regex="1" highlight="value" /> 
<element pattern="[0-9]+" is_regex="1" highlight="value" />
<element pattern="-[0-9]+" is_regex="1" highlight="value" />

</context>
</definition>
</bflang>