Skip to content

Commit 92f5139

Browse files
committed
1 parent 1d3a8c9 commit 92f5139

2 files changed

Lines changed: 14 additions & 22 deletions

File tree

‎CSharp.lua/CoreSystem.Lua/CoreSystem/Core.lua‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ local function staticCtorSetBase(cls)
211211
cls[k] = v
212212
end
213213
cls[cls] = nil
214-
local kind = cls.kind
214+
local kind = cls.__kind__
215215
cls.__kind__ = nil
216216
setBase(cls, kind)
217217
cls:__staticCtor__()
@@ -903,16 +903,21 @@ ValueType = {
903903
return setmetatable({}, cls)
904904
end,
905905
__clone__ = function(this)
906-
local cls = getmetatable(this)
907-
local t = {}
908-
for k, v in pairs(this) do
909-
if type(v) == "table" and v.__kind__ == "S" then
910-
t[k] = v:__clone__()
911-
else
912-
t[k] = v
906+
local type_ = type(this)
907+
if type_ == "number" or type_ == "bool" then
908+
return this
909+
elseif type_ == "table" then
910+
local cls = getmetatable(this)
911+
local t = {}
912+
for k, v in pairs(this) do
913+
if type(v) == "table" and v.__kind__ == "S" then
914+
t[k] = v:__clone__()
915+
else
916+
t[k] = v
917+
end
913918
end
919+
return setmetatable(t, cls)
914920
end
915-
return setmetatable(t, cls)
916921
end,
917922
EqualsObj = function (this, obj)
918923
if getmetatable(this) ~= getmetatable(obj) then return false end

‎CSharp.lua/CoreSystem.Lua/Sample/test.lua‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -292,16 +292,3 @@ test(testSplit, "testSplit")
292292
--test(testConsole, "Console")
293293
--test(testIO, "IO")
294294
test(testStringBuilder, "StringBuilder")
295-
296-
local pos = System.MultiArray(System.Int)({
297-
2,
298-
2,
299-
3
300-
}, 1, 2, 3, 3, 4, 5, 1, 3, 3, 2, 3, 4)
301-
System.Console.WriteLine(pos:get(0, 1, 1))
302-
local arr = System.MultiArray(System.Int)({
303-
2,
304-
3
305-
}, 1, 2, 4, 3, 4, 6)
306-
System.Console.WriteLine(arr:get(0, 0))
307-

0 commit comments

Comments
 (0)