typescript-to-lua 1.3.3 → 1.4.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/CompilerOptions.d.ts +1 -1
- package/dist/CompilerOptions.js +0 -1
- package/dist/LuaLib.d.ts +13 -1
- package/dist/LuaLib.js +62 -65
- package/dist/LuaPrinter.js +13 -12
- package/dist/cli/parse.js +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -1
- package/dist/lualib/ArrayConcat.lua +1 -1
- package/dist/lualib/ArrayEntries.lua +1 -1
- package/dist/lualib/ArrayEvery.lua +2 -2
- package/dist/lualib/ArrayFilter.lua +2 -2
- package/dist/lualib/ArrayFind.lua +2 -2
- package/dist/lualib/ArrayFindIndex.lua +2 -2
- package/dist/lualib/ArrayFlat.lua +1 -1
- package/dist/lualib/ArrayFlatMap.lua +2 -2
- package/dist/lualib/ArrayForEach.lua +2 -2
- package/dist/lualib/ArrayFrom.lua +32 -0
- package/dist/lualib/ArrayIncludes.lua +1 -1
- package/dist/lualib/ArrayIndexOf.lua +1 -1
- package/dist/lualib/ArrayIsArray.lua +1 -1
- package/dist/lualib/ArrayJoin.lua +1 -1
- package/dist/lualib/ArrayMap.lua +2 -2
- package/dist/lualib/ArrayPush.lua +1 -1
- package/dist/lualib/ArrayReduce.lua +2 -2
- package/dist/lualib/ArrayReduceRight.lua +2 -2
- package/dist/lualib/ArrayReverse.lua +1 -1
- package/dist/lualib/ArraySetLength.lua +1 -1
- package/dist/lualib/ArrayShift.lua +1 -1
- package/dist/lualib/ArraySlice.lua +1 -1
- package/dist/lualib/ArraySome.lua +2 -2
- package/dist/lualib/ArraySort.lua +2 -2
- package/dist/lualib/ArraySplice.lua +1 -1
- package/dist/lualib/ArrayToObject.lua +1 -1
- package/dist/lualib/ArrayUnshift.lua +1 -1
- package/dist/lualib/Await.lua +13 -13
- package/dist/lualib/Class.lua +1 -1
- package/dist/lualib/ClassExtends.lua +1 -1
- package/dist/lualib/CloneDescriptor.lua +1 -1
- package/dist/lualib/Decorate.lua +5 -5
- package/dist/lualib/DecorateParam.lua +2 -2
- package/dist/lualib/DelegatedYield.lua +1 -1
- package/dist/lualib/Delete.lua +1 -1
- package/dist/lualib/Error.lua +68 -69
- package/dist/lualib/FunctionBind.lua +1 -1
- package/dist/lualib/Generator.lua +26 -23
- package/dist/lualib/InstanceOf.lua +1 -1
- package/dist/lualib/InstanceOfObject.lua +1 -1
- package/dist/lualib/Iterator.lua +35 -32
- package/dist/lualib/Map.lua +131 -129
- package/dist/lualib/MathAtan2.lua +1 -1
- package/dist/lualib/MathSign.lua +1 -1
- package/dist/lualib/New.lua +1 -1
- package/dist/lualib/Number.lua +1 -1
- package/dist/lualib/NumberIsFinite.lua +1 -1
- package/dist/lualib/NumberIsNaN.lua +1 -1
- package/dist/lualib/NumberToString.lua +42 -39
- package/dist/lualib/ObjectAssign.lua +1 -1
- package/dist/lualib/ObjectDefineProperty.lua +1 -1
- package/dist/lualib/ObjectEntries.lua +1 -1
- package/dist/lualib/ObjectFromEntries.lua +1 -1
- package/dist/lualib/ObjectGetOwnPropertyDescriptor.lua +1 -1
- package/dist/lualib/ObjectGetOwnPropertyDescriptors.lua +1 -1
- package/dist/lualib/ObjectKeys.lua +1 -1
- package/dist/lualib/ObjectRest.lua +1 -1
- package/dist/lualib/ObjectValues.lua +1 -1
- package/dist/lualib/ParseFloat.lua +1 -1
- package/dist/lualib/ParseInt.lua +39 -36
- package/dist/lualib/Promise.lua +148 -152
- package/dist/lualib/PromiseAll.lua +5 -5
- package/dist/lualib/PromiseAllSettled.lua +5 -5
- package/dist/lualib/PromiseAny.lua +5 -5
- package/dist/lualib/PromiseRace.lua +5 -5
- package/dist/lualib/Set.lua +120 -118
- package/dist/lualib/SetDescriptor.lua +67 -64
- package/dist/lualib/SourceMapTraceBack.lua +7 -6
- package/dist/lualib/SparseArrayNew.lua +1 -1
- package/dist/lualib/SparseArrayPush.lua +1 -1
- package/dist/lualib/SparseArraySpread.lua +1 -1
- package/dist/lualib/Spread.lua +1 -1
- package/dist/lualib/StringAccess.lua +1 -1
- package/dist/lualib/StringCharAt.lua +1 -1
- package/dist/lualib/StringCharCodeAt.lua +1 -1
- package/dist/lualib/StringConcat.lua +1 -1
- package/dist/lualib/StringEndsWith.lua +1 -1
- package/dist/lualib/StringIncludes.lua +1 -1
- package/dist/lualib/StringPadEnd.lua +1 -1
- package/dist/lualib/StringPadStart.lua +1 -1
- package/dist/lualib/StringReplace.lua +2 -2
- package/dist/lualib/StringReplaceAll.lua +4 -4
- package/dist/lualib/StringSlice.lua +1 -1
- package/dist/lualib/StringSplit.lua +1 -1
- package/dist/lualib/StringStartsWith.lua +1 -1
- package/dist/lualib/StringSubstr.lua +1 -1
- package/dist/lualib/StringSubstring.lua +1 -1
- package/dist/lualib/StringTrim.lua +1 -1
- package/dist/lualib/StringTrimEnd.lua +1 -1
- package/dist/lualib/StringTrimStart.lua +1 -1
- package/dist/lualib/Symbol.lua +14 -11
- package/dist/lualib/SymbolRegistry.lua +13 -10
- package/dist/lualib/TypeOf.lua +1 -1
- package/dist/lualib/Unpack.lua +1 -1
- package/dist/lualib/WeakMap.lua +41 -39
- package/dist/lualib/WeakSet.lua +37 -35
- package/dist/lualib/lualib_bundle.lua +1096 -932
- package/dist/lualib/lualib_module_info.json +628 -0
- package/dist/lualib-build/plugin.d.ts +23 -0
- package/dist/lualib-build/plugin.js +138 -0
- package/dist/lualib-build/util.d.ts +19 -0
- package/dist/lualib-build/util.js +43 -0
- package/dist/transformation/builtins/array.d.ts +1 -1
- package/dist/transformation/builtins/array.js +5 -0
- package/dist/transformation/builtins/function.js +2 -1
- package/dist/transformation/builtins/index.d.ts +1 -0
- package/dist/transformation/builtins/index.js +63 -16
- package/dist/transformation/context/index.js +5 -1
- package/dist/transformation/utils/diagnostics.d.ts +3 -0
- package/dist/transformation/utils/diagnostics.js +2 -1
- package/dist/transformation/utils/typescript/index.js +5 -1
- package/dist/transformation/utils/typescript/types.d.ts +2 -0
- package/dist/transformation/utils/typescript/types.js +10 -1
- package/dist/transformation/visitors/class/index.js +1 -5
- package/dist/transformation/visitors/class/new.d.ts +1 -2
- package/dist/transformation/visitors/class/new.js +1 -40
- package/dist/transformation/visitors/conditional.js +15 -14
- package/dist/transformation/visitors/identifier.js +5 -0
- package/dist/transformation/visitors/literal.js +22 -0
- package/dist/transformation/visitors/modules/import.js +4 -14
- package/dist/transpilation/bundle.js +1 -1
- package/dist/transpilation/index.js +5 -1
- package/dist/transpilation/plugins.d.ts +19 -1
- package/dist/transpilation/plugins.js +6 -2
- package/dist/transpilation/resolve.js +2 -2
- package/dist/transpilation/transpile.d.ts +1 -1
- package/dist/transpilation/transpile.js +13 -5
- package/dist/transpilation/transpiler.js +25 -11
- package/dist/transpilation/utils.d.ts +2 -0
- package/package.json +12 -11
- package/CHANGELOG.md +0 -703
package/dist/lualib/Map.lua
CHANGED
|
@@ -1,140 +1,142 @@
|
|
|
1
|
-
Map
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
self
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if iterable[Symbol.iterator] then
|
|
14
|
-
local iterator = iterable[Symbol.iterator](iterable)
|
|
15
|
-
while true do
|
|
16
|
-
local result = iterator:next()
|
|
17
|
-
if result.done then
|
|
18
|
-
break
|
|
19
|
-
end
|
|
20
|
-
local value = result.value
|
|
21
|
-
self:set(value[1], value[2])
|
|
1
|
+
local Map
|
|
2
|
+
do
|
|
3
|
+
Map = __TS__Class()
|
|
4
|
+
Map.name = "Map"
|
|
5
|
+
function Map.prototype.____constructor(self, entries)
|
|
6
|
+
self[Symbol.toStringTag] = "Map"
|
|
7
|
+
self.items = {}
|
|
8
|
+
self.size = 0
|
|
9
|
+
self.nextKey = {}
|
|
10
|
+
self.previousKey = {}
|
|
11
|
+
if entries == nil then
|
|
12
|
+
return
|
|
22
13
|
end
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
local iterable = entries
|
|
15
|
+
if iterable[Symbol.iterator] then
|
|
16
|
+
local iterator = iterable[Symbol.iterator](iterable)
|
|
17
|
+
while true do
|
|
18
|
+
local result = iterator:next()
|
|
19
|
+
if result.done then
|
|
20
|
+
break
|
|
21
|
+
end
|
|
22
|
+
local value = result.value
|
|
23
|
+
self:set(value[1], value[2])
|
|
24
|
+
end
|
|
25
|
+
else
|
|
26
|
+
local array = entries
|
|
27
|
+
for ____, kvp in ipairs(array) do
|
|
28
|
+
self:set(kvp[1], kvp[2])
|
|
29
|
+
end
|
|
27
30
|
end
|
|
28
31
|
end
|
|
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
|
-
|
|
32
|
+
function Map.prototype.clear(self)
|
|
33
|
+
self.items = {}
|
|
34
|
+
self.nextKey = {}
|
|
35
|
+
self.previousKey = {}
|
|
36
|
+
self.firstKey = nil
|
|
37
|
+
self.lastKey = nil
|
|
38
|
+
self.size = 0
|
|
39
|
+
end
|
|
40
|
+
function Map.prototype.delete(self, key)
|
|
41
|
+
local contains = self:has(key)
|
|
42
|
+
if contains then
|
|
43
|
+
self.size = self.size - 1
|
|
44
|
+
local next = self.nextKey[key]
|
|
45
|
+
local previous = self.previousKey[key]
|
|
46
|
+
if next and previous then
|
|
47
|
+
self.nextKey[previous] = next
|
|
48
|
+
self.previousKey[next] = previous
|
|
49
|
+
elseif next then
|
|
50
|
+
self.firstKey = next
|
|
51
|
+
self.previousKey[next] = nil
|
|
52
|
+
elseif previous then
|
|
53
|
+
self.lastKey = previous
|
|
54
|
+
self.nextKey[previous] = nil
|
|
55
|
+
else
|
|
56
|
+
self.firstKey = nil
|
|
57
|
+
self.lastKey = nil
|
|
58
|
+
end
|
|
59
|
+
self.nextKey[key] = nil
|
|
60
|
+
self.previousKey[key] = nil
|
|
56
61
|
end
|
|
57
|
-
self.
|
|
58
|
-
|
|
62
|
+
self.items[key] = nil
|
|
63
|
+
return contains
|
|
59
64
|
end
|
|
60
|
-
self
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
for ____, key in __TS__Iterator(self:keys()) do
|
|
65
|
-
callback(_G, self.items[key], key, self)
|
|
65
|
+
function Map.prototype.forEach(self, callback)
|
|
66
|
+
for ____, key in __TS__Iterator(self:keys()) do
|
|
67
|
+
callback(nil, self.items[key], key, self)
|
|
68
|
+
end
|
|
66
69
|
end
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return self.items[key]
|
|
70
|
-
end
|
|
71
|
-
function Map.prototype.has(self, key)
|
|
72
|
-
return self.nextKey[key] ~= nil or self.lastKey == key
|
|
73
|
-
end
|
|
74
|
-
function Map.prototype.set(self, key, value)
|
|
75
|
-
local isNewValue = not self:has(key)
|
|
76
|
-
if isNewValue then
|
|
77
|
-
self.size = self.size + 1
|
|
70
|
+
function Map.prototype.get(self, key)
|
|
71
|
+
return self.items[key]
|
|
78
72
|
end
|
|
79
|
-
self
|
|
80
|
-
|
|
81
|
-
self.firstKey = key
|
|
82
|
-
self.lastKey = key
|
|
83
|
-
elseif isNewValue then
|
|
84
|
-
self.nextKey[self.lastKey] = key
|
|
85
|
-
self.previousKey[key] = self.lastKey
|
|
86
|
-
self.lastKey = key
|
|
73
|
+
function Map.prototype.has(self, key)
|
|
74
|
+
return self.nextKey[key] ~= nil or self.lastKey == key
|
|
87
75
|
end
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
end
|
|
93
|
-
function Map.prototype.entries(self)
|
|
94
|
-
local ____temp_0 = self
|
|
95
|
-
local items = ____temp_0.items
|
|
96
|
-
local nextKey = ____temp_0.nextKey
|
|
97
|
-
local key = self.firstKey
|
|
98
|
-
return {
|
|
99
|
-
[Symbol.iterator] = function(self)
|
|
100
|
-
return self
|
|
101
|
-
end,
|
|
102
|
-
next = function(self)
|
|
103
|
-
local result = {done = not key, value = {key, items[key]}}
|
|
104
|
-
key = nextKey[key]
|
|
105
|
-
return result
|
|
76
|
+
function Map.prototype.set(self, key, value)
|
|
77
|
+
local isNewValue = not self:has(key)
|
|
78
|
+
if isNewValue then
|
|
79
|
+
self.size = self.size + 1
|
|
106
80
|
end
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
end,
|
|
116
|
-
next = function(self)
|
|
117
|
-
local result = {done = not key, value = key}
|
|
118
|
-
key = nextKey[key]
|
|
119
|
-
return result
|
|
81
|
+
self.items[key] = value
|
|
82
|
+
if self.firstKey == nil then
|
|
83
|
+
self.firstKey = key
|
|
84
|
+
self.lastKey = key
|
|
85
|
+
elseif isNewValue then
|
|
86
|
+
self.nextKey[self.lastKey] = key
|
|
87
|
+
self.previousKey[key] = self.lastKey
|
|
88
|
+
self.lastKey = key
|
|
120
89
|
end
|
|
121
|
-
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
90
|
+
return self
|
|
91
|
+
end
|
|
92
|
+
Map.prototype[Symbol.iterator] = function(self)
|
|
93
|
+
return self:entries()
|
|
94
|
+
end
|
|
95
|
+
function Map.prototype.entries(self)
|
|
96
|
+
local ____temp_0 = self
|
|
97
|
+
local items = ____temp_0.items
|
|
98
|
+
local nextKey = ____temp_0.nextKey
|
|
99
|
+
local key = self.firstKey
|
|
100
|
+
return {
|
|
101
|
+
[Symbol.iterator] = function(self)
|
|
102
|
+
return self
|
|
103
|
+
end,
|
|
104
|
+
next = function(self)
|
|
105
|
+
local result = {done = not key, value = {key, items[key]}}
|
|
106
|
+
key = nextKey[key]
|
|
107
|
+
return result
|
|
108
|
+
end
|
|
109
|
+
}
|
|
110
|
+
end
|
|
111
|
+
function Map.prototype.keys(self)
|
|
112
|
+
local nextKey = self.nextKey
|
|
113
|
+
local key = self.firstKey
|
|
114
|
+
return {
|
|
115
|
+
[Symbol.iterator] = function(self)
|
|
116
|
+
return self
|
|
117
|
+
end,
|
|
118
|
+
next = function(self)
|
|
119
|
+
local result = {done = not key, value = key}
|
|
120
|
+
key = nextKey[key]
|
|
121
|
+
return result
|
|
122
|
+
end
|
|
123
|
+
}
|
|
124
|
+
end
|
|
125
|
+
function Map.prototype.values(self)
|
|
126
|
+
local ____temp_1 = self
|
|
127
|
+
local items = ____temp_1.items
|
|
128
|
+
local nextKey = ____temp_1.nextKey
|
|
129
|
+
local key = self.firstKey
|
|
130
|
+
return {
|
|
131
|
+
[Symbol.iterator] = function(self)
|
|
132
|
+
return self
|
|
133
|
+
end,
|
|
134
|
+
next = function(self)
|
|
135
|
+
local result = {done = not key, value = items[key]}
|
|
136
|
+
key = nextKey[key]
|
|
137
|
+
return result
|
|
138
|
+
end
|
|
139
|
+
}
|
|
140
|
+
end
|
|
141
|
+
Map[Symbol.species] = Map
|
|
138
142
|
end
|
|
139
|
-
Map[Symbol.species] = Map
|
|
140
|
-
Map = Map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
__TS__MathAtan2 = math.atan2 or math.atan
|
|
1
|
+
local __TS__MathAtan2 = math.atan2 or math.atan
|
package/dist/lualib/MathSign.lua
CHANGED
package/dist/lualib/New.lua
CHANGED
package/dist/lualib/Number.lua
CHANGED
|
@@ -1,41 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
local __TS__NumberToString
|
|
2
|
+
do
|
|
3
|
+
local radixChars = "0123456789abcdefghijklmnopqrstuvwxyz"
|
|
4
|
+
function __TS__NumberToString(self, radix)
|
|
5
|
+
if radix == nil or radix == 10 or self == math.huge or self == -math.huge or self ~= self then
|
|
6
|
+
return tostring(self)
|
|
7
|
+
end
|
|
8
|
+
radix = math.floor(radix)
|
|
9
|
+
if radix < 2 or radix > 36 then
|
|
10
|
+
error("toString() radix argument must be between 2 and 36", 0)
|
|
11
|
+
end
|
|
12
|
+
local integer, fraction = math.modf(math.abs(self))
|
|
13
|
+
local result = ""
|
|
14
|
+
if radix == 8 then
|
|
15
|
+
result = string.format("%o", integer)
|
|
16
|
+
elseif radix == 16 then
|
|
17
|
+
result = string.format("%x", integer)
|
|
18
|
+
else
|
|
19
|
+
repeat
|
|
20
|
+
do
|
|
21
|
+
result = __TS__StringAccess(radixChars, integer % radix) .. result
|
|
22
|
+
integer = math.floor(integer / radix)
|
|
23
|
+
end
|
|
24
|
+
until not (integer ~= 0)
|
|
25
|
+
end
|
|
26
|
+
if fraction ~= 0 then
|
|
27
|
+
result = result .. "."
|
|
28
|
+
local delta = 1e-16
|
|
29
|
+
repeat
|
|
30
|
+
do
|
|
31
|
+
fraction = fraction * radix
|
|
32
|
+
delta = delta * radix
|
|
33
|
+
local digit = math.floor(fraction)
|
|
34
|
+
result = result .. __TS__StringAccess(radixChars, digit)
|
|
35
|
+
fraction = fraction - digit
|
|
36
|
+
end
|
|
37
|
+
until not (fraction >= delta)
|
|
38
|
+
end
|
|
39
|
+
if self < 0 then
|
|
40
|
+
result = "-" .. result
|
|
41
|
+
end
|
|
42
|
+
return result
|
|
5
43
|
end
|
|
6
|
-
radix = math.floor(radix)
|
|
7
|
-
if radix < 2 or radix > 36 then
|
|
8
|
-
error("toString() radix argument must be between 2 and 36", 0)
|
|
9
|
-
end
|
|
10
|
-
local integer, fraction = math.modf(math.abs(self))
|
|
11
|
-
local result = ""
|
|
12
|
-
if radix == 8 then
|
|
13
|
-
result = string.format("%o", integer)
|
|
14
|
-
elseif radix == 16 then
|
|
15
|
-
result = string.format("%x", integer)
|
|
16
|
-
else
|
|
17
|
-
repeat
|
|
18
|
-
do
|
|
19
|
-
result = __TS__StringAccess(____radixChars, integer % radix) .. result
|
|
20
|
-
integer = math.floor(integer / radix)
|
|
21
|
-
end
|
|
22
|
-
until not (integer ~= 0)
|
|
23
|
-
end
|
|
24
|
-
if fraction ~= 0 then
|
|
25
|
-
result = result .. "."
|
|
26
|
-
local delta = 1e-16
|
|
27
|
-
repeat
|
|
28
|
-
do
|
|
29
|
-
fraction = fraction * radix
|
|
30
|
-
delta = delta * radix
|
|
31
|
-
local digit = math.floor(fraction)
|
|
32
|
-
result = result .. __TS__StringAccess(____radixChars, digit)
|
|
33
|
-
fraction = fraction - digit
|
|
34
|
-
end
|
|
35
|
-
until not (fraction >= delta)
|
|
36
|
-
end
|
|
37
|
-
if self < 0 then
|
|
38
|
-
result = "-" .. result
|
|
39
|
-
end
|
|
40
|
-
return result
|
|
41
44
|
end
|
package/dist/lualib/ParseInt.lua
CHANGED
|
@@ -1,40 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
____string_match_result__0_0
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
local __TS__ParseInt
|
|
2
|
+
do
|
|
3
|
+
local parseIntBasePattern = "0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTvVwWxXyYzZ"
|
|
4
|
+
function __TS__ParseInt(numberString, base)
|
|
5
|
+
if base == nil then
|
|
6
|
+
base = 10
|
|
7
|
+
local hexMatch = string.match(numberString, "^%s*-?0[xX]")
|
|
8
|
+
if hexMatch then
|
|
9
|
+
base = 16
|
|
10
|
+
local ____string_match_result__0_0
|
|
11
|
+
if string.match(hexMatch, "-") then
|
|
12
|
+
____string_match_result__0_0 = "-" .. __TS__StringSubstr(numberString, #hexMatch)
|
|
13
|
+
else
|
|
14
|
+
____string_match_result__0_0 = __TS__StringSubstr(numberString, #hexMatch)
|
|
15
|
+
end
|
|
16
|
+
numberString = ____string_match_result__0_0
|
|
13
17
|
end
|
|
14
|
-
numberString = ____string_match_result__0_0
|
|
15
18
|
end
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
19
|
+
if base < 2 or base > 36 then
|
|
20
|
+
return 0 / 0
|
|
21
|
+
end
|
|
22
|
+
local ____temp_1
|
|
23
|
+
if base <= 10 then
|
|
24
|
+
____temp_1 = __TS__StringSubstring(parseIntBasePattern, 0, base)
|
|
25
|
+
else
|
|
26
|
+
____temp_1 = __TS__StringSubstr(parseIntBasePattern, 0, 10 + 2 * (base - 10))
|
|
27
|
+
end
|
|
28
|
+
local allowedDigits = ____temp_1
|
|
29
|
+
local pattern = ("^%s*(-?[" .. allowedDigits) .. "]*)"
|
|
30
|
+
local number = tonumber(
|
|
31
|
+
string.match(numberString, pattern),
|
|
32
|
+
base
|
|
33
|
+
)
|
|
34
|
+
if number == nil then
|
|
35
|
+
return 0 / 0
|
|
36
|
+
end
|
|
37
|
+
if number >= 0 then
|
|
38
|
+
return math.floor(number)
|
|
39
|
+
else
|
|
40
|
+
return math.ceil(number)
|
|
41
|
+
end
|
|
39
42
|
end
|
|
40
43
|
end
|