本文整理汇总了Java中org.luaj.vm2.Globals.load方法的典型用法代码示例。如果您正苦于以下问题:Java Globals.load方法的具体用法?Java Globals.load怎么用?Java Globals.load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.luaj.vm2.Globals
的用法示例。
在下文中一共展示了Globals.load方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: standardGlobals
import org.luaj.vm2.Globals; //导入方法依赖的package包/类
/**
* Create a standard set of globals for JSE including all the libraries.
*
* @return Table of globals initialized with the standard JSE libraries
* @see #debugGlobals()
* @see JsePlatform
* @see JmePlatform
*/
public static Globals standardGlobals() {
Globals globals = new Globals();
globals.load(new JseBaseLib());
globals.load(new PackageLib());
globals.load(new Bit32Lib());
globals.load(new TableLib());
globals.load(new StringLib());
globals.load(new CoroutineLib());
globals.load(new JseMathLib());
globals.load(new JseOsLib());
// globals.load(new JseIoLib());//安全考虑,删除for LuaView
// globals.load(new LuajavaLib());//安全考虑,删除for LuaView
LoadState.install(globals);
LuaC.install(globals);
return globals;
}
示例2: main
import org.luaj.vm2.Globals; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
//Globals globals = JsePlatform.standardGlobals();
Globals globals = new Globals();
globals.load(new JseBaseLib());
globals.load(new PackageLib());
globals.load(new Bit32Lib());
globals.load(new TableLib());
globals.load(new StringLib());
globals.load(new CoroutineLib());
globals.load(new JseMathLib());
globals.load(new JseIoLib());
globals.load(new JseOsLib());
globals.load(new JavaLibInteractionTest());
LoadState.install(globals);
LuaC.install(globals);
System.out.println(new File(".").getAbsolutePath());
System.out.println(new File(args[0]).exists());
LuaValue chunk = globals.loadfile(new File(args[0]).getAbsolutePath());
chunk.call();
}
示例3: setupCompilerGlobal
import org.luaj.vm2.Globals; //导入方法依赖的package包/类
private static Globals setupCompilerGlobal() {
// Create server globals with just enough library support to compile user
// scripts.
compiler = new Globals();
compiler.load(new JseBaseLib());
compiler.load(new PackageLib());
compiler.load(new StringLib());
// To load scripts, we occasionally need a math library in addition to compiler
// support.
// To limit scripts using the debug library, they must be closures, so we only
// install LuaC.
compiler.load(new JseMathLib());
LoadState.install(compiler);
LuaC.install(compiler);
// Set up the LuaString metatable to be read-only since it is shared across all
// scripts.
LuaString.s_metatable = new ReadOnlyLuaTable(LuaString.s_metatable);
return compiler;
}
示例4: standardGlobals
import org.luaj.vm2.Globals; //导入方法依赖的package包/类
/**
* Create a standard set of globals for JSE including all the libraries.
*
* @return Table of globals initialized with the standard JSE libraries
* @see #debugGlobals()
* @see JsePlatform
* @see org.luaj.vm2.lib.jme.JmePlatform
*/
public static Globals standardGlobals() {
Globals globals = new Globals();
globals.load(new JseBaseLib());
globals.load(new PackageLib());
globals.load(new Bit32Lib());
globals.load(new TableLib());
globals.load(new StringLib());
globals.load(new CoroutineLib());
globals.load(new JseMathLib());
globals.load(new JseIoLib());
globals.load(new JseOsLib());
globals.load(new LuajavaLib());
LoadState.install(globals);
LuaC.install(globals);
return globals;
}
示例5: doLoad
import org.luaj.vm2.Globals; //导入方法依赖的package包/类
/**
* 真正加载一个库
*
* @param globals
* @param name
* @return
*/
public LuaValue doLoad(final Globals globals, final String name) {
if (mLazyLoadLibs != null && mLazyLoadLibs.containsKey(name)) {
final LuaValue lib = mLazyLoadLibs.get(name);
LuaValue result = globals.load(lib);
mLazyLoadLibs.remove(name);
return result;
}
return null;
}
示例6: getLocalCompiler
import org.luaj.vm2.Globals; //导入方法依赖的package包/类
private Globals getLocalCompiler() {
Globals user_globals = new Globals();
user_globals.load(new JseBaseLib());
user_globals.load(new PackageLib());
user_globals.load(new Bit32Lib());
user_globals.load(new TableLib());
user_globals.load(new StringLib());
user_globals.load(new JseMathLib());
user_globals.load(new DebugLib());
sethook = user_globals.get("debug").get("sethook");
user_globals.set("debug", LuaValue.NIL);
return user_globals;
}
示例7: standardGlobals
import org.luaj.vm2.Globals; //导入方法依赖的package包/类
/**
* Create a standard set of globals for JSE including all the libraries.
*
* @return Table of globals initialized with the standard JSE libraries
* @see #debugGlobals()
* @see org.luaj.vm2.lib.jse.JsePlatform
* @see org.luaj.vm2.lib.jme.JmePlatform
*/
public static Globals standardGlobals() {
Globals globals = new Globals();
globals.load(new JseBaseLib());
globals.load(new PackageLib());
globals.load(new Bit32Lib());
globals.load(new TableLib());
globals.load(new StringLib());
globals.load(new JseMathLib());
globals.load(new JseOsLib());
LoadState.install(globals);
LuaC.install(globals);
return globals;
}
示例8: testLuaRunner
import org.luaj.vm2.Globals; //导入方法依赖的package包/类
@Test
public void testLuaRunner() {
String luaScript = Utils.toString(new File("lua_test/test.lua"));
Globals globals = JsePlatform.standardGlobals();
LuaValue value = globals.load(luaScript);
value.invoke();
}
示例9: execute
import org.luaj.vm2.Globals; //导入方法依赖的package包/类
@Test
public void execute() throws Exception {
Globals globals = JsePlatform.standardGlobals();
// globals.set("LCallback", new LCallback());
LuaValue value = globals.load(helloWorldScript);
value.call();
}
示例10: newStandard
import org.luaj.vm2.Globals; //导入方法依赖的package包/类
/**
* Create a new lua Globals object representing the standard one used in this game
*
* @return a new Globals instance
*/
public static Globals newStandard() {
Globals globals = new Globals();
globals.load(new JseBaseLib());
globals.load(new PackageLib());
globals.load(new Bit32Lib());
globals.load(new TableLib());
globals.load(new StringLib());
globals.load(new JseMathLib());
LoadState.install(globals);
LuaC.install(globals);
LuaJC.install(globals);
return globals;
}
示例11: debugGlobals
import org.luaj.vm2.Globals; //导入方法依赖的package包/类
/** Create standard globals including the {@link debug} library.
*
* @return Table of globals initialized with the standard JSE and debug libraries
* @see #standardGlobals()
* @see JsePlatform
* @see JmePlatform
* @see DebugLib
*/
public static Globals debugGlobals() {
Globals globals = standardGlobals();
globals.load(new DebugLib());
return globals;
}
示例12: debugGlobals
import org.luaj.vm2.Globals; //导入方法依赖的package包/类
/**
* Create standard globals including the {@link DebugLib} library.
*
* @return Table of globals initialized with the standard JSE and debug libraries
* @see #standardGlobals()
* @see org.luaj.vm2.lib.jse.JsePlatform
* @see org.luaj.vm2.lib.jme.JmePlatform
* @see DebugLib
*/
public static Globals debugGlobals() {
Globals globals = standardGlobals();
globals.load(new DebugLib());
return globals;
}
示例13: debugGlobals
import org.luaj.vm2.Globals; //导入方法依赖的package包/类
/** Create standard globals including the {@link DebugLib} library.
*
* @return Table of globals initialized with the standard JSE and debug libraries
* @see #standardGlobals()
* @see JsePlatform
* @see org.luaj.vm2.lib.jme.JmePlatform
* @see DebugLib
*/
public static Globals debugGlobals() {
Globals globals = standardGlobals();
globals.load(new DebugLib());
return globals;
}