Thread: array search
View Single Post
  #2  
Old 12-27-2005, 03:21 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
You could just create a function class and join the class to NPCs you wish to use it in.

Also, it might be a bit nicer to use the built-in for () iterator.
PHP Code:
function find(arrattrval)
{
  for (
keyarr)
  {
    if (
key.(@attr) == val)
    {
      return 
key;
    }
  }
  return -
1;

__________________
Skyld
Reply With Quote