From 2b77665c22bda6686d5d2257f2e0195ecebee024 Mon Sep 17 00:00:00 2001 From: mfranz <mfranz> Date: Thu, 20 Nov 2008 23:03:24 +0000 Subject: [PATCH] setCursor: complain and show options if wrong cursor name was given --- Nasal/gui.nas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Nasal/gui.nas b/Nasal/gui.nas index d4dcd47cb..0246b0ddb 100644 --- a/Nasal/gui.nas +++ b/Nasal/gui.nas @@ -62,7 +62,10 @@ var setCursor = func(x = nil, y = nil, cursor = nil) { if (x != nil) args.getNode("x", 1).setIntValue(x); if (y != nil) args.getNode("y", 1).setIntValue(y); if (cursor != nil) { - if (num(cursor) == nil) cursor = cursor_types[cursor]; + if (num(cursor) == nil) + cursor = cursor_types[cursor]; + if (cursor == nil) + die("cursor must be one of: " ~ string.join(", ", keys(cursor_types))); setprop("/sim/mouse/hide-cursor", cursor); args.getNode("cursor", 1).setIntValue(cursor); }