Notifications
Clear all
[Closed] Searching Array?
Apr 02, 2010 3:27 pm
Hi everyone,
I have an array with a bunch of object. Is it possible to search that array to see if a specific object is in it? I’m wondering if I can use the name of the object to see if its present in this given array.
Thanks for you time. Have a good day.
1 Reply
Apr 02, 2010 3:27 pm
If you have the object you’re looking for itself, you can simply use findItem. If you just have the name, something like this could work:
function containsObject objectArray objectName =
(
local objFound = false;
for o in objectArray while (not objFound) do
(
if (o.name == objectName) do
objFound = true;
)
objFound; --return the objFound value.
)