diff --git a/src/opcodes.c b/src/opcodes.c
index c266de1c899fa8c3195c385dd77a506d72c90522..65d7b1ff67ed3289b89868ebc5c5f41334b072ca 100644
--- a/src/opcodes.c
+++ b/src/opcodes.c
@@ -22,7 +22,7 @@
 #include "builtin_functions.h"
 #include "module_support.h"
 
-RCSID("$Id: opcodes.c,v 1.21 1998/04/26 11:44:24 hubbe Exp $");
+RCSID("$Id: opcodes.c,v 1.22 1998/05/06 13:27:40 grubba Exp $");
 
 void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)
 {
@@ -191,6 +191,34 @@ void o_cast(struct pike_string *type, INT32 run_time_type)
 	  case T_FLOAT:
 	    sprintf(buf,"%f",(double)sp[-1].u.float_number);
 	    break;
+
+	  case T_ARRAY:
+	    {
+	      int i;
+	      struct array *a = sp[-1].u.array;
+	      struct pike_string *s;
+
+	      for(i = a->size; i--; ) {
+		if (a->item[i].type != T_INT) {
+		  error("cast: Item %d is not an integer.\n", i);
+		}
+		if ((a->item[i].u.integer < 0) ||
+		    (a->item[i].u.integer > 255)) {
+		  error("cast: Wide strings are not supported yet.\n"
+			"Index %d is %d, and is out of range 0 .. 255.\n",
+			i, a->item[i].u.integer);
+		}
+	      }
+	      s = begin_shared_string(a->size);
+	      for(i = a->size; i--; ) {
+		s->str[i] = a->item[i].u.integer;
+	      }
+	      s = end_shared_string(s);
+	      pop_stack();
+	      push_string(s);
+	      return;
+	    }
+	    break;
 	    
 	  default:
 	    error("Cannot cast to string.\n");