aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2022-02-05 21:21:09 +0000
committers-ol <s+removethis@s-ol.nu>2025-03-02 14:24:49 +0000
commitea71daa57d5c153aeb09159acd1e32ca791006e0 (patch)
treedc3056afa6ae664b18be59ec359d96afd39eb42c
parentlib: test and extend string module (diff)
downloadalive-ea71daa57d5c153aeb09159acd1e32ca791006e0.tar.gz
alive-ea71daa57d5c153aeb09159acd1e32ca791006e0.zip
builtins: small bugfixes
-rw-r--r--alv/base/op.moon1
-rw-r--r--alv/builtins.moon5
2 files changed, 2 insertions, 4 deletions
diff --git a/alv/base/op.moon b/alv/base/op.moon
index a6b0947..bda30f5 100644
--- a/alv/base/op.moon
+++ b/alv/base/op.moon
@@ -170,6 +170,7 @@ class Op
-- @tparam Type type
-- @tparam[opt] any val initial value
setup_out: (metatype, type, val) =>
+ metatype = '~' if metatype == '='
if @out and @out.type == type and @out.metatype == metatype
-- we can just keep it. do nothing.
return false
diff --git a/alv/builtins.moon b/alv/builtins.moon
index 2e86d4c..9203064 100644
--- a/alv/builtins.moon
+++ b/alv/builtins.moon
@@ -354,15 +354,12 @@ switch_ = Constant.meta
if i\type! == T.bang
if i\dirty!
@state += 1
- while @state >= #values
- @state -= #values
- @state
+ @state = @state % (#values)
else
@state = switch i!
when true then 0
when false then 1
else (math.floor i!) % #values
- @state
@out\set if v = values[@state + 1] then v!