本文整理汇总了Java中org.luaj.vm2.lib.LibFunction类的典型用法代码示例。如果您正苦于以下问题:Java LibFunction类的具体用法?Java LibFunction怎么用?Java LibFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LibFunction类属于org.luaj.vm2.lib包,在下文中一共展示了LibFunction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bindMethods
import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
/**
* bind lua functions using method
*
* @param factory
* @param methods
* @return
*/
public static LuaTable bindMethods(Class<? extends LibFunction> factory, List<Method> methods) {
LuaTable env = new LuaTable();
try {
if (methods != null) {
for (int i = 0; i < methods.size(); i++) {
LibFunction f = factory.newInstance();
f.opcode = -1;
f.method = methods.get(i);
f.name = methods.get(i).getName();
env.set(f.name, f);
}
}
} catch (Exception e) {
throw new LuaError("[Bind Failed] " + e);
} finally {
return env;
}
}
示例2: bind
import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
/**
* bind lua functions using opcode
*
* @param factory
* @param methods
* @return
*/
public static LuaTable bind(Class<? extends LibFunction> factory, List<String> methods) {
LuaTable env = new LuaTable();
try {
if (methods != null) {
for (int i = 0; i < methods.size(); i++) {
LibFunction f = factory.newInstance();
f.opcode = i;
f.method = null;
f.name = methods.get(i);
env.set(f.name, f);
}
}
} catch (Exception e) {
throw new LuaError("[Bind Failed] " + e);
} finally {
return env;
}
}
示例3: createMetatable
import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
/**
* create metatable for libs
*
* @return
*/
public static LuaTable createMetatable(Class<? extends LibFunction> libClass) {
LuaTable result = AppCache.getCache(CACHE_METATABLES).get(libClass);//get from cache
if (result == null) {
LuaTable libTable = null;
if (LuaViewConfig.isUseNoReflection()) {
final List<String> methodNames = getMapperMethodNames(libClass);
libTable = LuaViewManager.bind(libClass, methodNames);
} else {
final List<Method> methods = getMapperMethods(libClass);
libTable = LuaViewManager.bindMethods(libClass, methods);
}
result = LuaValue.tableOf(new LuaValue[]{LuaValue.INDEX, libTable, LuaValue.NEWINDEX, new NewIndexFunction(libTable)});
//update cache
AppCache.getCache(CACHE_METATABLES).put(libClass, result);
}
return result;
}
示例4: call
import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
private LuaValue call(LuaValue env, Class<? extends LibFunction> libClass) {
final LuaTable metatable = (libClass == null || LuaViewConfig.isLibsLazyLoad() == false) ? LuaViewManager.createMetatable(libClass) : null;//当不是lazyLoad或者lib为空(常量)的时候直接加载
if (luaNames != null) {
for (String name : luaNames) {
env.set(name, createCreator(env, metatable));
}
}
return metatable;
}
示例5: getMapperClass
import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
return UIRefreshScrollerMethodMapper.class;
}
示例6: getMapperClass
import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
return null;
}
示例7: BaseVarArgUICreator
import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
public BaseVarArgUICreator(Globals globals, LuaValue metatable, Class<? extends LibFunction> libClass) {
this.globals = globals;
this.metatable = metatable;
this.libClass = libClass;
}
示例8: BaseVarArgCreator
import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
public BaseVarArgCreator(Globals globals, LuaValue metatable, Class<? extends LibFunction> libClass) {
this.globals = globals;
this.metatable = metatable;
this.libClass = libClass;
}
示例9: getMapperClass
import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
return BitmapMethodMapper.class;
}
示例10: getMapperClass
import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
return VibratorMethodMapper.class;
}
示例11: getMapperClass
import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
return AudioMethodMapper.class;
}
示例12: getMapperClass
import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
return TimerMethodMapper.class;
}
示例13: getMapperClass
import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
return DataMethodMapper.class;
}
示例14: getMapperClass
import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
return UICircleViewPagerIndicatorMethodMapper.class;
}
示例15: getMapperClass
import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
return UICustomViewPagerIndicatorMethodMapper.class;
}