Skip to content

A lightweight, high-performance Molang parser and runtime for Java 17+

License

Notifications You must be signed in to change notification settings

LotusSeries/MoLi

Repository files navigation

MoLi

Java License Build

MoLi (Molang Library) is a modern, lightweight, and high-performance Molang interpreter written in java, designed for speed, flexibility, and ease of use in your projects!

Example:

import dev.wvr.moli.MoLi;
import dev.wvr.moli.runtime.Environment;

public class Example {
    static void main(String[] args) {
        // simple eval
        float result = MoLi.eval("math.cos(0) * 10 + 5"); 
        System.out.println(result); // 15.0

        // with variables
        Environment env = Environment.map();
        env.set("v.health", 20.0f);
        
        float logic = MoLi.eval("v.health < 10 ? 1 : 0", env);
        System.out.println(logic); // 0.0
    }
}