Skip to content

DragonRex004/modengine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔧 ModEngine – Lightweight Lua Modding for Java Projects

ModEngine is a simple and powerful library that enables Lua scripting support in any Java application. It’s perfect for adding modding support to your games or tools — letting users write custom behavior in Lua, safely and easily.


✨ Features

  • ✅ Lightweight and dependency-free (based on LuaJ – pure Java)
  • 🧠 Register your own Java functions and objects to be called from Lua
  • 📜 Run Lua scripts from files or inline strings
  • 📂 Load mod scripts from a folder

📦 Installation

Gradle

dependencies {
    implementation("com.yourgroup:luamodengine:1.0.0") // Replace with real coordinates
}

Maven

<dependency>
  <groupId>com.yourgroup</groupId>
  <artifactId>luamodengine</artifactId>
  <version>1.0.0</version>
</dependency>

Requires Java 8+ and no native libraries.

🚀 Getting Started Initialize the engine:

ModdingEngine engine = new ModdingEngine();

Register a custom Java function:

engine.registerFunction("sayHello", new OneArgFunction() {
    @Override
    public LuaValue call(LuaValue name) {
        System.out.println("Hello, " + name.tojstring() + "!");
        return LuaValue.NIL;
    }
});

Run inline Lua code:

engine.runScript("sayHello('world')");

Or load a Lua script file:

engine.runScript(new File("mods/my_script.lua"));

📁 Mod Folder Support You can automatically load all .lua scripts in a folder:

engine.loadAllMods(new File("mods/"));

🧪 Example Lua Script

local id = spawn("dragon")
print("Spawned entity with ID: " .. id)

🛡️ Security Consideration This engine does not sandbox Lua by default. Be cautious when executing third-party scripts and consider running them in a restricted environment or process.

🤝 Contributing Contributions, bug reports and feature requests are welcome!

Fork this repo

Create a branch

Submit a PR

📄 License MIT – free for personal and commercial use.

🧠 Inspired by LuaJ

Classic modding frameworks for Minecraft and other games

💬 Contact Feel free to reach out via GitHub Issues or open a discussion for feature ideas.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published