Skip to content

Trollhunters501/LuaEngineNK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

LuaEngineNK

Java Lua JavaScript

Run Lua in Nukkit!

Requirements:

JSEngineNK Plugin: https://cloudburstmc.org/resources/jsenginenk.939/

LuaLib Plugin: https://github.com/Trollhunters501/LuaLib

Know Basic JavaScript

Installation:

Easily installed with a JSEngineNK script:

if(!script.getScriptByName("LuaEngineNK")){
   load("https://cdn.jsdelivr.net/gh/Trollhunters501/LuaEngineNK/src/Creadores/Program/LuaEngineNK.js");
}

Engine Creation:

Just add this code to your script and you can use Lua!

var TestLua = new LuaEngineNK().build();

Eval:

TestLua.eval("print('hello world!')");

Default variables:

getLogger return logger by JSEngineNK

getServer return server

manager return manager by JSEngineNK

plugin return main Class by JSEngineNK

Specify Variables (put):

TestLua.put("Variable", objectJava);
//also applies to setNnClassLoader!

setNnClassLoader:

This function does the same thing as JSEngineNK's Nnclassloader API but passed to Lua example:

TestLua.setNnClassLoader({ urls: ["https://test.com/test.jar"] }, {
  variable: "class.example"//...
});

It also has most of the features of PHPEngineNK (minus code conversion and print)

evalFile:

Run Ruby code from a file:

TestLua.evalFile(manager.getFile("TestLua", "Test.lua"));

More Info: https://github.com/luaj/luaj