isaacscript-common 1.0.525 → 1.0.526
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/functions/util.d.ts +7 -2
- package/dist/functions/util.lua +13 -0
- package/package.json +1 -1
package/dist/functions/util.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
3
3
|
/**
|
|
4
|
-
* Using a
|
|
5
|
-
*
|
|
4
|
+
* Using a Map constructor to copy a Map does not seem to work properly, so use this helper function
|
|
5
|
+
* instead.
|
|
6
|
+
*/
|
|
7
|
+
export declare function copyMap<K, V>(oldMap: Map<K, V>): Map<K, V>;
|
|
8
|
+
/**
|
|
9
|
+
* Using a Set constructor to copy a Set does not seem to work properly, so use this helper function
|
|
10
|
+
* instead.
|
|
6
11
|
*/
|
|
7
12
|
export declare function copySet<T>(oldSet: Set<T>): Set<T>;
|
|
8
13
|
/**
|
package/dist/functions/util.lua
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
4
|
local HEX_STRING_LENGTH = 6
|
|
5
|
+
function ____exports.copyMap(self, oldMap)
|
|
6
|
+
local newMap = __TS__New(Map)
|
|
7
|
+
for ____, ____value in __TS__Iterator(
|
|
8
|
+
oldMap:entries()
|
|
9
|
+
) do
|
|
10
|
+
local key
|
|
11
|
+
key = ____value[1]
|
|
12
|
+
local value
|
|
13
|
+
value = ____value[2]
|
|
14
|
+
newMap:set(key, value)
|
|
15
|
+
end
|
|
16
|
+
return newMap
|
|
17
|
+
end
|
|
5
18
|
function ____exports.copySet(self, oldSet)
|
|
6
19
|
local newSet = __TS__New(Set)
|
|
7
20
|
for ____, value in __TS__Iterator(
|