Thread: array search
View Single Post
  #3  
Old 12-27-2005, 03:24 PM
jake13jake jake13jake is offline
Former Classic Staff
jake13jake's Avatar
Join Date: Dec 2002
Location: Northwest Vermont
Posts: 1,452
jake13jake will become famous soon enough
Quote:
Originally Posted by 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;

oh cooool... I didn't know gscript2 ripped that out of java . I still think it would be useful as a built in function though. I'd honestly rather have it as a public function, but you can't do clientside public functions.
Reply With Quote