0 votes

I'm know it's a pretty trivial task, I'm know I can make a function of it, I just wanna know if GDSCRIPT already has a native one line approach for it.

for python I found this: https://stackoverflow.com/questions/3170055/test-if-lists-share-any-items-in-python

Godot version 3.3.2
in Engine by (63 points)
edited by

1 Answer

0 votes
array1 = []
array2 = []

func _process(delta):
    for i in array1:
        for o in array2:
            if i == o:
                print("yes")
by (266 points)

Remember to break after one match was found, so that the CPU doesn't waste time comparing elements after one set of elements was found to be matching.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.