浏览代码

new math functions

Kajetan Johannes Hammerle 4 年之前
父节点
当前提交
47f1326245
共有 1 个文件被更改,包括 2 次插入0 次删除
  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<>();