aboutsummaryrefslogtreecommitdiffstats
path: root/lib/util.moon
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.moon')
-rw-r--r--lib/util.moon13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/util.moon b/lib/util.moon
new file mode 100644
index 0000000..7306fbc
--- /dev/null
+++ b/lib/util.moon
@@ -0,0 +1,13 @@
+import Op from require 'base'
+
+class pick extends Op
+ setup: (@i, ...) =>
+ @choices = { ... }
+
+ update: =>
+ i = 1 + (math.floor @i\get!) % #@choices
+ @value = @choices[i]\get!
+
+{
+ :pick
+}