Search in sources :

Example 6 with LuaClosure

use of org.luaj.vm2.LuaClosure in project aerospike-client-java by aerospike.

the class LuaInstance method loadPackage.

public void loadPackage(Statement statement) {
    if (loadedTable.get(statement.getPackageName()).toboolean()) {
        return;
    }
    Prototype prototype;
    if (statement.getResourceLoader() == null || statement.getResourcePath() == null) {
        prototype = LuaCache.loadPackageFromFile(statement.getPackageName());
    } else {
        prototype = LuaCache.loadPackageFromResource(statement.getResourceLoader(), statement.getResourcePath(), statement.getPackageName());
    }
    LuaClosure function = new LuaClosure(prototype, globals);
    function.invoke();
    loadedTable.set(statement.getPackageName(), LuaValue.TRUE);
}
Also used : Prototype(org.luaj.vm2.Prototype) LuaClosure(org.luaj.vm2.LuaClosure)

Aggregations

LuaClosure (org.luaj.vm2.LuaClosure)2 LuaString (org.luaj.vm2.LuaString)2 LuaValue (org.luaj.vm2.LuaValue)2 Prototype (org.luaj.vm2.Prototype)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 LuaThread (org.luaj.vm2.LuaThread)1 UpValue (org.luaj.vm2.UpValue)1