YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

comparring arrays
comarius
#1 Posted : Saturday, October 28, 2017 12:21:36 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 10/10/2017(UTC)
Posts: 2
Location: Toronto

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Hi,
is there a way to compare arrays in script ?
The line below does not complain, does not evaluate ?


if(myobj.getReceivedBuffer() == [0xff,0xfe,0x21])
{

}
fagiano
#2 Posted : Sunday, October 29, 2017 7:31:17 PM(UTC)
Rank: Advanced Member

Groups: Registered, Administrators
Joined: 6/11/2005(UTC)
Posts: 1,059

Thanks: 0 times
Was thanked: 79 time(s) in 61 post(s)
The == operator only checks if they are the same array, it doesn't check if they are a different array with the same content. So if you want to check if 2 arrays have the same content you'll have to check element by element.

Alberto
Follow me on Twitter @squirrellang
Users browsing this topic
Guest (3)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Clean Slate theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.084 seconds.