Fix: [Script] Access to enum/consts defined outside of main.nut (#14176)

This commit is contained in:
Loïc Guilloux
2025-05-01 18:16:32 +02:00
committed by GitHub
parent 1f212e6f2a
commit 41b113840a
4 changed files with 21 additions and 5 deletions

View File

@@ -17,6 +17,10 @@ function Regression::TestInit()
print(" IsValid(vehicle.plane_speed): " + AIGameSettings.IsValid("vehicle.plane_speed"));
print(" vehicle.plane_speed: " + AIGameSettings.GetValue("vehicle.plane_speed"));
require("require.nut");
print(" TestEnum.value1: " + ::TestEnum.value1);
print(" test_constant: " + ::test_constant);
print(" TestEnum.value2: " + TestEnum.value2);
print(" test_constant: " + test_constant);
print(" min(6, 3): " + min(6, 3));
print(" min(3, 6): " + min(3, 6));
print(" max(6, 3): " + max(6, 3));

View File

@@ -1,2 +1,9 @@
print(" Required this file");
const test_constant = 1;
enum TestEnum {
value0,
value1,
value2
};

View File

@@ -8,6 +8,10 @@
IsValid(vehicle.plane_speed): true
vehicle.plane_speed: 2
Required this file
TestEnum.value1: 1
test_constant: 1
TestEnum.value2: 2
test_constant: 1
min(6, 3): 3
min(3, 6): 3
max(6, 3): 6
@@ -81,7 +85,7 @@
20
30
40
Ops: 8673
Ops: 8649
--Std--
abs(-21): 21
@@ -9763,9 +9767,9 @@ ERROR: IsEnd() is invalid as Begin() is never called
--Valuate() with excessive CPU usage--
Your script made an error: excessive CPU usage in valuator function
*FUNCTION [unknown()] regression/main.nut line [2065]
*FUNCTION [unknown()] regression/main.nut line [2069]
*FUNCTION [Valuate()] NATIVE line [-1]
*FUNCTION [Start()] regression/main.nut line [2066]
*FUNCTION [Start()] regression/main.nut line [2070]
[id] 0
[this] TABLE
@@ -9774,7 +9778,7 @@ Your script made an error: excessive CPU usage in valuator function
[this] INSTANCE
Your script made an error: excessive CPU usage in valuator function
*FUNCTION [Start()] regression/main.nut line [2066]
*FUNCTION [Start()] regression/main.nut line [2070]
[Infinite] CLOSURE
[list] INSTANCE