arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

Mathematical Methods

circle-exclamation

This page is a work in progress and may not have the polish of a usual Evie-Written document!

Some quick docs:

hashtag
enmap.math(key, operation, operator, [objectPath])

Possible Operators (accepts all variations listed below, as strings):

  • +, add, addition: Increments the value in the enmap by the provided value.

  • -, sub, subtract: Decrements the value in the enmap by the provided value.

hashtag
enmap.inc(key, [objectPath])

hashtag
enmap.dec(key. [objectPath])

*, mult, multiply: Multiply the value in the enmap by the provided value.

  • /, div, divide: Divide the value in the enmap by the provided value.

  • %, mod, modulo: Gets the modulo of the value in the enmap by the provided value.

  • ^, exp, exponential: Raises the value in the enmap by the power of the provided value.

  • // Assuming
    points.set("number", 42);
    points.set("numberInObject", {sub: { anInt: 5 }});
     
    points.math("number", "/", 2); // 21
    points.math("number", "add", 5); // 26
    points.math("number", "modulo", 3); // 2
    points.math("numberInObject", "+", 10, "sub.anInt");
    // Assuming
    points.set("number", 42);
    points.set("numberInObject", {sub: { anInt: 5 }});
     
    points.inc("number"); // 43
    points.inc("numberInObject", "sub.anInt"); // {sub: { anInt: 6 }}
    // Assuming
    points.set("number", 42);
    points.set("numberInObject", {sub: { anInt: 5 }});
     
    points.dec("number"); // 41
    points.dec("numberInObject", "sub.anInt"); // {sub: { anInt: 4 }}