Romano
August 15, 2020, 2:43pm
1
What is the proper way to(an array), if as nothing, it doesnt count? i mean if it as something do one thing, if as nothing do another.
arrangers
i made this but if array as nothing dont work.
> # Arrangers
> outputto "CONDUCTOR"
> json_foreach "arrangers"
> ifnot ""
> json_select "names"
> json_select "en"
> sayrest
> else
> say ""
> sayrest
>
> endif
>
> say ", "
> json_foreach_end
Romano
August 21, 2020, 12:21pm
2
Anyone? @dano @stevehero @Florian
Maybe its a noob question but i want to learn
Not fully sure what you mean, do you want to know the length of the array and if 0 do something, else do another thing?
Here's the code I use for [ParserScriptIndex]=...
json_foreach "remixers" # REMIXERS COUNT
ifnot "0"
sayrest
else
say "-"
endif
json_foreach_end
Romano
August 21, 2020, 1:08pm
4
I meant if it as no value/nothing do one thing, and if it as data do Another,
Because if i use (the code above) that array and it as nothing it gives an error, and not if it as Something.
apear something else in conductor:
or if the album as arranjers(conductor):
is ok
Romano
August 22, 2020, 7:44am
6
Nope, it gives same error.
Romano
August 22, 2020, 1:46pm
8
Thats not it, because the
ifnot ""
its not working as it gets in the "Conductor" tag the next array that matches, if the arrangers have nothing:
Without the full script to test it's hard to troubleshoot. @Florian might have better success.
Romano
August 22, 2020, 3:43pm
10
What release gives the error?
Romano
August 22, 2020, 4:01pm
12
everyone that dont have something in the arrangers array, per example:
Planescape Torment: Enhanced Edition Official Soundtrack
http://vgmdb.info/album/73784
dano
August 22, 2020, 6:07pm
13
You need ifnot "0" instead of ifnot ""
Romano
August 22, 2020, 6:22pm
14
A simple thing like that, thank you @dano and @stevehero it worked, it opens a lot for me. It was driving me crazy.
I thought you might of tried the ifnot "0" of the code example in my first reply. It'll check the array length.
The index starts at zero and not one. Few languages use 1 as the first index.
Good you got it sorted.