Compare string with speed

Considering the following piece of code in the speed pattern:

#set($brandName = $player.brand.name)
#set($brandNameExample = "NameExample")

#if($brandName == $brandNameExample)
    11111
#else
    22222
#end

      

I always get 22222

. Of course player.brand.name = "NameExample"

.

Can someone explain to me why and how to get it to work?

+3


source to share


2 answers


Well, I found a solution: I called speed twice: the first time without the player object and the second with it. Therefore, on the first call, all directives concerning the player cannot be evaluated and null is returned. Thanks everyone for your help.



+1


source


I would recommend testing this

#set($brandName = "NameExample")
#set($brandNameExample = "NameExample")
#if($brandName == $brandNameExample)
11111
#else
22222
#end

      



if it works then i will try to output $ player, $ player.brand, $ player.brand.name you need to make sure $ player.brand.name is storing the correct value. - case sensitivity? - Make sure "$ player.brand.name" is spelled correctly?

I think you just have a problem in the $ player object

+2


source







All Articles