]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[script] Sprite and Image objects inherit from an empty scalar
authorCharlie Brej <cbrej@cs.man.ac.uk>
Tue, 13 Oct 2009 21:41:42 +0000 (22:41 +0100)
committerCharlie Brej <cbrej@cs.man.ac.uk>
Tue, 13 Oct 2009 21:41:42 +0000 (22:41 +0100)
Sprite and Image objects now inherit from an empty scalar which can be used to
keep any random data assoceated with that object. Previously there was a
dangerous tendency to pass any scalar operations to the top inherrited scalar
which was the class prototype.

src/plugins/splash/script/script-lib-image.script
src/plugins/splash/script/script-lib-sprite.script

index a64a3e45ed3860f3a015bb4dc7a7222d3b3e8968..68f0de1b5b61f1dcf6e0d2c3b19179847d7db1f6 100644 (file)
@@ -1,6 +1,6 @@
-Image.Adopt = funraw_image)
+Image.Adopt = fun (raw_image)
 {
-  if (raw_image) return raw_image | Image;
+  if (raw_image) return raw_image | [] | Image;
   else return NULL;
 };
 
index b88127f5e563151e084f15072d4487246cff62aa..eab0142ebaa761af5544c06ad6c9210c251a48b3 100644 (file)
@@ -5,9 +5,9 @@ Sprite.SetPosition = fun (x, y, z)
   this.SetZ(z);
 };
 
-Sprite |= fun(image)
+Sprite |= fun (image)
 {
-  new_sprite = Sprite._New() | Sprite;
+  new_sprite = Sprite._New() | [] | Sprite;
   if (image) new_sprite.SetImage(image);
   return new_sprite;
 };