当前位置: 首页>>代码示例>>Java>>正文


Java LibFunction类代码示例

本文整理汇总了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;
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:26,代码来源:LuaViewManager.java

示例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;
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:26,代码来源:LuaViewManager.java

示例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;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:25,代码来源:LuaViewManager.java

示例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;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:10,代码来源:BaseFunctionBinder.java

示例5: getMapperClass

import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
    return UIRefreshScrollerMethodMapper.class;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:5,代码来源:UIRefreshScollerBinder.java

示例6: getMapperClass

import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
    return null;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:5,代码来源:NavigationBinder.java

示例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;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:6,代码来源:BaseVarArgUICreator.java

示例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;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:6,代码来源:BaseVarArgCreator.java

示例9: getMapperClass

import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
    return BitmapMethodMapper.class;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:5,代码来源:BitmapBinder.java

示例10: getMapperClass

import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
    return VibratorMethodMapper.class;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:5,代码来源:VibratorBinder.java

示例11: getMapperClass

import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
    return AudioMethodMapper.class;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:5,代码来源:AudioBinder.java

示例12: getMapperClass

import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
    return TimerMethodMapper.class;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:5,代码来源:TimerBinder.java

示例13: getMapperClass

import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
    return DataMethodMapper.class;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:5,代码来源:DataBinder.java

示例14: getMapperClass

import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
    return UICircleViewPagerIndicatorMethodMapper.class;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:5,代码来源:UICircleViewPagerIndicatorBinder.java

示例15: getMapperClass

import org.luaj.vm2.lib.LibFunction; //导入依赖的package包/类
@Override
public Class<? extends LibFunction> getMapperClass() {
    return UICustomViewPagerIndicatorMethodMapper.class;
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:5,代码来源:UICustomViewPagerIndicatorBinder.java


注:本文中的org.luaj.vm2.lib.LibFunction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。