1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-28 17:09:10 +00:00

Add: [Script] Cloning ScriptList

This commit is contained in:
glx22
2025-05-26 18:50:06 +02:00
committed by Loïc Guilloux
parent 7200e7f509
commit 938acbe6ef
8 changed files with 58 additions and 1 deletions

View File

@@ -828,6 +828,13 @@ function Regression::List()
print(" []:");
print(" 4000 => " + list[4000]);
print(" clone:");
local list3 = clone list;
print(" Clone ListDump:");
foreach (idx, val in list3) {
print(" " + idx + " => " + val);
}
list.Clear();
print(" IsEmpty(): " + list.IsEmpty());
@@ -860,6 +867,12 @@ function Regression::List()
it = list.Next();
print(" " + it + " => " + list.GetValue(it));
}
print(" Clone ListDump:");
foreach (idx, val in list3) {
print(" " + idx + " => " + val);
}
}
function Regression::Map()

View File

@@ -575,6 +575,13 @@
4006 => 12
[]:
4000 => 50
clone:
Clone ListDump:
1005 => 1005
4000 => 50
4001 => 8002
4002 => 8004
4006 => 12
IsEmpty(): true
0 => 5 (true)
ERROR: Next() is invalid as Begin() is never called
@@ -584,6 +591,12 @@ ERROR: IsEnd() is invalid as Begin() is never called
2 => 6 (true)
3 => 6 (true)
9 => 0 (false)
Clone ListDump:
1005 => 1005
4000 => 50
4001 => 8002
4002 => 8004
4006 => 12
--Company--
SetName(): true
@@ -9795,7 +9808,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
constructor failed with: excessive CPU usage in list filter function
Your script made an error: excessive CPU usage in valuator function
*FUNCTION [Start()] regression/main.nut line [2120]
*FUNCTION [Start()] regression/main.nut line [2133]
[Infinite] CLOSURE
[list] INSTANCE