Browse Source

new math functions

Kajetan Johannes Hammerle 4 years ago
parent
commit
47f1326245
1 changed files with 2 additions and 0 deletions
  1. 2 0
      src/me/hammerle/snuviscript/code/FunctionRegistry.java

+ 2 - 0
src/me/hammerle/snuviscript/code/FunctionRegistry.java

@@ -128,6 +128,8 @@ public class FunctionRegistry {
             int factor = (int) Math.pow(10, in[1].getInt(sc));
             return (double) (((double) Math.round(d * factor)) / factor);
         });
+        registerFunction("math.min", (sc, in) -> Math.min(in[0].getDouble(sc), in[1].getDouble(sc)));
+        registerFunction("math.max", (sc, in) -> Math.max(in[0].getDouble(sc), in[1].getDouble(sc)));
         registerFunction("list.new", (sc, in) -> {
             if(in.length == 0) {
                 return new ArrayList<>();