@Override public LuaFunction load(Prototype prototype, String chunkname, LuaValue env) throws IOException { return new LuaClosure(prototype, env); } }
public LuaFunction load(Prototype prototype, String chunkname, LuaValue env) throws IOException { return new LuaClosure(prototype, env); }
public LuaFunction load(Prototype prototype, String chunkname, LuaValue env) throws IOException { return new LuaClosure(prototype, env); }
/** @deprecated * Use Globals.load(InputString, String, String) instead, * or LuaC.compile(InputStream, String) and construct LuaClosure directly. */ public LuaValue load(InputStream stream, String chunkname, Globals globals) throws IOException { return new LuaClosure(compile(stream, chunkname), globals); }
/** @deprecated * Use Globals.load(InputString, String, String) instead, * or LuaC.compile(InputStream, String) and construct LuaClosure directly. */ public LuaValue load(InputStream stream, String chunkname, Globals globals) throws IOException { return new LuaClosure(compile(stream, chunkname), globals); }
private synchronized void initialize(){ Prototype binary = null; String lua; if( mClosure != null ){ return; } lua = mElement.getTextContent(); if( mLuaType == LUA_TYPE.enum_function ){ lua = "function main()" + '\n' + lua + '\n' +"end"; } try{ binary = mGlobals.compilePrototype(new ByteArrayInputStream(lua.getBytes("UTF-8")), getID()); mClosure = new LuaClosure(binary, mGlobals); mClosure.call(); } catch (Exception e){ e.printStackTrace(); } }
private LuaValue loadModule(ParsedPageName chunkName) throws LuaError { Prototype prototype = compiledScriptCache.getPrototypeForChunkname(chunkName); if (prototype != null) { return new LuaClosure(prototype, globals); } else { try (InputStream is = findPackage(chunkName)) { return new LuaClosure( loadAndCache(is, chunkName), globals); } catch (ScribuntoException | IOException e) { logger.error("error loading '"+chunkName+"'", e); throw new LuaError(e); } } }
private LuaJScriptEngine create(KeyValueObjectCache aScene, String aScriptCode, String aMethodName) throws IOException { CacheEntry theCacheEntry = prototypes.get(aScriptCode); if (theCacheEntry == null) { Globals theGlobals = createGlobals(aScene); Prototype thePrototype = theGlobals.compilePrototype(new StringReader(aScriptCode), "script"); // Initialize the globals and the code LuaClosure theClosure = new LuaClosure(thePrototype, theGlobals); theClosure.call(); theCacheEntry = new CacheEntry(thePrototype, theGlobals); prototypes.put(aScriptCode, theCacheEntry); } return theCacheEntry.getScriptEngineFor(aScene, aMethodName); } }
private void loadSystemPackage(ClassLoader resourceLoader, String packageName) { String resourcePath = "udf/" + packageName + ".lua"; Prototype prototype = LuaCache.loadPackageFromResource(resourceLoader, resourcePath, packageName); LuaClosure function = new LuaClosure(prototype, globals); function.invoke(); loadedTable.set(packageName, LuaValue.TRUE); }
private void loadSystemPackage(ClassLoader resourceLoader, String packageName) { String resourcePath = "udf/" + packageName + ".lua"; Prototype prototype = LuaCache.loadPackageFromResource(resourceLoader, resourcePath, packageName); LuaClosure function = new LuaClosure(prototype, globals); function.invoke(); loadedTable.set(packageName, LuaValue.TRUE); }
LuaClosure closure = new LuaClosure(compiledScript, globals); closure.call();
closure = new LuaClosure(binary, mGlobals);
closure = new LuaClosure(binary, global);
LuaClosure closure = new LuaClosure(compiledScript, globals); closure.call(); LuaClosure closure = new LuaClosure(compiledScript, globals); closure.call();
protected LuaValue loadFunction(String functionName, Prototype prototype, Frame frame) throws ScribuntoException { try { currentFrame = frame; LuaValue function = new LuaClosure(prototype, globals).checkfunction().call().get(functionName); if (function.isnil()) { throw new ScribuntoException("no such function '"+functionName+"'"); } return function; } catch (LuaError e) { throw new ScribuntoException(e); } finally { currentFrame = null; } }
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); }
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); }
LuaClosure ncl = new LuaClosure(newp, globals); Upvaldesc[] uv = newp.upvalues; for ( int j=0, nup=uv.length; j<nup; ++j ) {
LuaClosure ncl = new LuaClosure(newp, globals); Upvaldesc[] uv = newp.upvalues; for ( int j=0, nup=uv.length; j<nup; ++j ) {
LuaClosure ncl = new LuaClosure(newp, globals); Upvaldesc[] uv = newp.upvalues; for ( int j=0, nup=uv.length; j<nup; ++j ) {