typescript-to-lua 1.26.0 → 1.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/LuaLib.d.ts +1 -0
- package/dist/LuaLib.js +1 -0
- package/dist/lualib/5.0/MathSign.lua +5 -4
- package/dist/lualib/5.0/MathTrunc.lua +6 -0
- package/dist/lualib/5.0/lualib_bundle.lua +21 -12
- package/dist/lualib/5.0/lualib_module_info.json +11 -0
- package/dist/lualib/universal/MathSign.lua +5 -4
- package/dist/lualib/universal/MathTrunc.lua +6 -0
- package/dist/lualib/universal/lualib_bundle.lua +21 -12
- package/dist/lualib/universal/lualib_module_info.json +11 -0
- package/dist/transformation/builtins/math.js +3 -0
- package/package.json +1 -1
package/dist/LuaLib.d.ts
CHANGED
package/dist/LuaLib.js
CHANGED
|
@@ -76,6 +76,7 @@ var LuaLibFeature;
|
|
|
76
76
|
LuaLibFeature["MathAtan2"] = "MathAtan2";
|
|
77
77
|
LuaLibFeature["MathModf"] = "MathModf";
|
|
78
78
|
LuaLibFeature["MathSign"] = "MathSign";
|
|
79
|
+
LuaLibFeature["MathTrunc"] = "MathTrunc";
|
|
79
80
|
LuaLibFeature["New"] = "New";
|
|
80
81
|
LuaLibFeature["Number"] = "Number";
|
|
81
82
|
LuaLibFeature["NumberIsFinite"] = "NumberIsFinite";
|
|
@@ -1500,13 +1500,29 @@ local function __TS__MathModf(x)
|
|
|
1500
1500
|
return integral, x - integral
|
|
1501
1501
|
end
|
|
1502
1502
|
|
|
1503
|
+
local function __TS__NumberIsNaN(value)
|
|
1504
|
+
return value ~= value
|
|
1505
|
+
end
|
|
1506
|
+
|
|
1503
1507
|
local function __TS__MathSign(val)
|
|
1504
|
-
if val
|
|
1505
|
-
return
|
|
1506
|
-
|
|
1508
|
+
if __TS__NumberIsNaN(val) or val == 0 then
|
|
1509
|
+
return val
|
|
1510
|
+
end
|
|
1511
|
+
if val < 0 then
|
|
1507
1512
|
return -1
|
|
1508
1513
|
end
|
|
1509
|
-
return
|
|
1514
|
+
return 1
|
|
1515
|
+
end
|
|
1516
|
+
|
|
1517
|
+
local function __TS__NumberIsFinite(value)
|
|
1518
|
+
return type(value) == "number" and value == value and value ~= 1 / 0 and value ~= -(1 / 0)
|
|
1519
|
+
end
|
|
1520
|
+
|
|
1521
|
+
local function __TS__MathTrunc(val)
|
|
1522
|
+
if not __TS__NumberIsFinite(val) or val == 0 then
|
|
1523
|
+
return val
|
|
1524
|
+
end
|
|
1525
|
+
return val > 0 and math.floor(val) or math.ceil(val)
|
|
1510
1526
|
end
|
|
1511
1527
|
|
|
1512
1528
|
local function __TS__Number(value)
|
|
@@ -1536,18 +1552,10 @@ local function __TS__Number(value)
|
|
|
1536
1552
|
end
|
|
1537
1553
|
end
|
|
1538
1554
|
|
|
1539
|
-
local function __TS__NumberIsFinite(value)
|
|
1540
|
-
return type(value) == "number" and value == value and value ~= 1 / 0 and value ~= -(1 / 0)
|
|
1541
|
-
end
|
|
1542
|
-
|
|
1543
1555
|
local function __TS__NumberIsInteger(value)
|
|
1544
1556
|
return __TS__NumberIsFinite(value) and math.floor(value) == value
|
|
1545
1557
|
end
|
|
1546
1558
|
|
|
1547
|
-
local function __TS__NumberIsNaN(value)
|
|
1548
|
-
return value ~= value
|
|
1549
|
-
end
|
|
1550
|
-
|
|
1551
1559
|
local function __TS__StringSubstring(self, start, ____end)
|
|
1552
1560
|
if ____end ~= ____end then
|
|
1553
1561
|
____end = 0
|
|
@@ -2719,6 +2727,7 @@ return {
|
|
|
2719
2727
|
__TS__MathAtan2 = __TS__MathAtan2,
|
|
2720
2728
|
__TS__MathModf = __TS__MathModf,
|
|
2721
2729
|
__TS__MathSign = __TS__MathSign,
|
|
2730
|
+
__TS__MathTrunc = __TS__MathTrunc,
|
|
2722
2731
|
__TS__New = __TS__New,
|
|
2723
2732
|
__TS__Number = __TS__Number,
|
|
2724
2733
|
__TS__NumberIsFinite = __TS__NumberIsFinite,
|
|
@@ -383,6 +383,17 @@
|
|
|
383
383
|
"MathSign": {
|
|
384
384
|
"exports": [
|
|
385
385
|
"__TS__MathSign"
|
|
386
|
+
],
|
|
387
|
+
"dependencies": [
|
|
388
|
+
"NumberIsNaN"
|
|
389
|
+
]
|
|
390
|
+
},
|
|
391
|
+
"MathTrunc": {
|
|
392
|
+
"exports": [
|
|
393
|
+
"__TS__MathTrunc"
|
|
394
|
+
],
|
|
395
|
+
"dependencies": [
|
|
396
|
+
"NumberIsFinite"
|
|
386
397
|
]
|
|
387
398
|
},
|
|
388
399
|
"New": {
|
|
@@ -1440,13 +1440,29 @@ local __TS__MathAtan2 = math.atan2 or math.atan
|
|
|
1440
1440
|
|
|
1441
1441
|
local __TS__MathModf = math.modf
|
|
1442
1442
|
|
|
1443
|
+
local function __TS__NumberIsNaN(value)
|
|
1444
|
+
return value ~= value
|
|
1445
|
+
end
|
|
1446
|
+
|
|
1443
1447
|
local function __TS__MathSign(val)
|
|
1444
|
-
if val
|
|
1445
|
-
return
|
|
1446
|
-
|
|
1448
|
+
if __TS__NumberIsNaN(val) or val == 0 then
|
|
1449
|
+
return val
|
|
1450
|
+
end
|
|
1451
|
+
if val < 0 then
|
|
1447
1452
|
return -1
|
|
1448
1453
|
end
|
|
1449
|
-
return
|
|
1454
|
+
return 1
|
|
1455
|
+
end
|
|
1456
|
+
|
|
1457
|
+
local function __TS__NumberIsFinite(value)
|
|
1458
|
+
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
1459
|
+
end
|
|
1460
|
+
|
|
1461
|
+
local function __TS__MathTrunc(val)
|
|
1462
|
+
if not __TS__NumberIsFinite(val) or val == 0 then
|
|
1463
|
+
return val
|
|
1464
|
+
end
|
|
1465
|
+
return val > 0 and math.floor(val) or math.ceil(val)
|
|
1450
1466
|
end
|
|
1451
1467
|
|
|
1452
1468
|
local function __TS__Number(value)
|
|
@@ -1476,18 +1492,10 @@ local function __TS__Number(value)
|
|
|
1476
1492
|
end
|
|
1477
1493
|
end
|
|
1478
1494
|
|
|
1479
|
-
local function __TS__NumberIsFinite(value)
|
|
1480
|
-
return type(value) == "number" and value == value and value ~= math.huge and value ~= -math.huge
|
|
1481
|
-
end
|
|
1482
|
-
|
|
1483
1495
|
local function __TS__NumberIsInteger(value)
|
|
1484
1496
|
return __TS__NumberIsFinite(value) and math.floor(value) == value
|
|
1485
1497
|
end
|
|
1486
1498
|
|
|
1487
|
-
local function __TS__NumberIsNaN(value)
|
|
1488
|
-
return value ~= value
|
|
1489
|
-
end
|
|
1490
|
-
|
|
1491
1499
|
local function __TS__StringSubstring(self, start, ____end)
|
|
1492
1500
|
if ____end ~= ____end then
|
|
1493
1501
|
____end = 0
|
|
@@ -2659,6 +2667,7 @@ return {
|
|
|
2659
2667
|
__TS__MathAtan2 = __TS__MathAtan2,
|
|
2660
2668
|
__TS__MathModf = __TS__MathModf,
|
|
2661
2669
|
__TS__MathSign = __TS__MathSign,
|
|
2670
|
+
__TS__MathTrunc = __TS__MathTrunc,
|
|
2662
2671
|
__TS__New = __TS__New,
|
|
2663
2672
|
__TS__Number = __TS__Number,
|
|
2664
2673
|
__TS__NumberIsFinite = __TS__NumberIsFinite,
|
|
@@ -389,6 +389,17 @@
|
|
|
389
389
|
"MathSign": {
|
|
390
390
|
"exports": [
|
|
391
391
|
"__TS__MathSign"
|
|
392
|
+
],
|
|
393
|
+
"dependencies": [
|
|
394
|
+
"NumberIsNaN"
|
|
395
|
+
]
|
|
396
|
+
},
|
|
397
|
+
"MathTrunc": {
|
|
398
|
+
"exports": [
|
|
399
|
+
"__TS__MathTrunc"
|
|
400
|
+
],
|
|
401
|
+
"dependencies": [
|
|
402
|
+
"NumberIsFinite"
|
|
392
403
|
]
|
|
393
404
|
},
|
|
394
405
|
"New": {
|
|
@@ -71,6 +71,9 @@ function transformMathCall(context, node, calledMethod) {
|
|
|
71
71
|
case "sign": {
|
|
72
72
|
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.MathSign, node, ...params);
|
|
73
73
|
}
|
|
74
|
+
case "trunc": {
|
|
75
|
+
return (0, lualib_1.transformLuaLibFunction)(context, lualib_1.LuaLibFeature.MathTrunc, node, ...params);
|
|
76
|
+
}
|
|
74
77
|
case "abs":
|
|
75
78
|
case "acos":
|
|
76
79
|
case "asin":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typescript-to-lua",
|
|
3
|
-
"version": "1.26.
|
|
3
|
+
"version": "1.26.1",
|
|
4
4
|
"description": "A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!",
|
|
5
5
|
"repository": "https://github.com/TypeScriptToLua/TypeScriptToLua",
|
|
6
6
|
"homepage": "https://typescripttolua.github.io/",
|