Skip to content

Commit d04173f

Browse files
author
雪千渔
committed
fixed bug
1 parent ef56eec commit d04173f

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

SysLib/Collections/Dictionary.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ function Dictionary:Remove(key)
4444
end
4545

4646
function Dictionary:Clear()
47-
for _, key in ipairs(self.m_index) do
48-
self:Remove(key)
49-
end
47+
self.m_count = 0
48+
self.m_dict = {}
49+
self.m_index = {}
5050
end
5151

5252
---@return number

SysLib/Collections/List.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-------------------ModuleInfo-------------------
22
--- Author : jxy
33
--- Date : 2020/02/16 00:00
4-
--- Description : 数组封装类,可以用lua迭代器访问
4+
--- Description : 数组封装类
55
--- https://github.com/JomiXedYu/JxCode.LuaSharp
66
------------------------------------------------
77
---@class SysLib.Collections.List : SysLib.Object
@@ -21,8 +21,8 @@ function List:Add(item)
2121
self.m_arr[self.m_count] = item
2222
end
2323

24-
function List:AddRange(ienumerator)
25-
for item in each(ienumerator) do
24+
function List:AddRange(enumerable)
25+
for item in each(enumerable) do
2626
self:Add(item)
2727
end
2828
end
@@ -49,6 +49,7 @@ function List:Clear()
4949
for i = 1, self.m_count do
5050
self.m_arr[i] = nil
5151
end
52+
self.m_count = 0
5253
end
5354

5455
---@return boolean

0 commit comments

Comments
 (0)