CraftTweaker

CraftTweaker

151M Downloads

defining a var inside a loop will cause the var to be unusable even if outside the loop

Laifsyn opened this issue ยท 2 comments

commented

Issue description

I had no clue what are the actually needed imports, so I'll just share them all
crafttweaker.log
edit: Acclaration, It will say that the variable already exists, so you can't use the same variable for another for-loop

Steps to reproduce

No response

Script used

https://pastebin.com/GAfe75Cw

The crafttweaker.log file

nan

Minecraft version

1.18

Modloader

Fabric

Modloader version

0.14.4x

CraftTweaker version

9.1.140

Other relevant information

No response

The latest.log file

commented

Easier script to reproduce:

var range = 0 .. 10;
for i in range {
    var j = i + 1; 
    println(j);
}

for i in range {
    var j = i + 1;  // Errors: "Duplicate variable name: j"
    println(j);
}
commented

This has been fixed by ZenCodeLang/ZenCode@ab2c02e