public synchronized static int insertLuaState(LuaState L){
  int i;
  for (i=0; i < states.size(); i++) {
    LuaState state=(LuaState)states.get(i);
    if (state != null) {
      if (state.getCPtrPeer() == L.getCPtrPeer())       return i;
    }
  }
  i=getNextStateIndex();
  states.set(i,L);
  return i;
}

public synchronized static int insertLuaState ( LuaState L ) { int i ; for ( i = 0 ; i < states . size ( ) ; i ++ ) { LuaState state = ( LuaState ) states . get ( i ) ; if ( state != null ) { if ( state . getCPtrPeer ( ) == L . getCPtrPeer ( ) ) return i ; } } i = getNextStateIndex ( ) ; states . set ( i , L ) ; return i ; }
receives a existing luastate and checks if it exists in the states list . if it doesn ' t exist adds it to the list .
