Java Code Examples for org.luaj.vm2.Varargs#opttable()

The following examples show how to use org.luaj.vm2.Varargs#opttable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UIImageViewMethodMapper.java    From VideoOS-Android-SDK with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 开始帧动画
 *
 * @param view
 * @param varargs 时间是秒而不是毫秒
 * @return
 */
@Deprecated
public LuaValue startAnimationImages(U view, Varargs varargs) {//TODO 支持UDImageView和UDBitmap
    final LuaTable imagesTable = varargs.opttable(2, null);
    final double duration = varargs.optdouble(3, 1f);
    boolean repeat = false;
    if (varargs.isnumber(4)) {
        repeat = varargs.optint(4, -1) > 0;
    } else {
        repeat = varargs.optboolean(4, false);
    }
    if (imagesTable != null && imagesTable.length() > 0) {
        final String[] images = new String[imagesTable.length()];
        int i = 0;
        for (LuaValue key : imagesTable.keys()) {
            images[i++] = imagesTable.get(key).optjstring(null);
        }
        return view.startAnimationImages(images, (int) duration * 1000, repeat);
    }
    return view;
}
 
Example 2
Source File: LVWebViewMethodMapper.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
public LuaValue webViewCallback(U view, Varargs varargs) {
    final LuaTable callback = varargs.opttable(2, null);
    if (callback != null) {
        LuaValue onClose = LuaUtil.getFunction(callback, "onClose", "onClose");
        return view.webViewCallback(onClose);
    }

    return LuaValue.valueOf("");
}
 
Example 3
Source File: LVWebViewMethodMapper.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
public LuaValue setInitData(U view, Varargs varargs) {
    final LuaTable data = varargs.opttable(2, null);
    if (data != null) {
        String jsData = JsonUtil.toString(data);
        return view.setInitData(jsData);
    }
    return LuaValue.valueOf("");
}
 
Example 4
Source File: VenvyUDSvgaImageView.java    From VideoOS-Android-SDK with GNU General Public License v3.0 4 votes vote down vote up
public VenvyUDSvgaImageView svgaCallback(Varargs varargs) {
    LuaTable callbacks = varargs.opttable(2, null);
    getView().setLuaCallback(callbacks);
    return this;
}
 
Example 5
Source File: VenvyActivityLifeCycleMapper.java    From VideoOS-Android-SDK with GNU General Public License v3.0 4 votes vote down vote up
public LuaValue pageCallback(U target, Varargs varargs) {
    final LuaTable callback = varargs.opttable(2, null);
    return target.setPageCallback(callback);
}
 
Example 6
Source File: VenvyMediaLifeCycleMapper.java    From VideoOS-Android-SDK with GNU General Public License v3.0 4 votes vote down vote up
public LuaValue mediaCallback(U target, Varargs varargs) {
    final LuaTable callback = varargs.opttable(2, null);
    return target.setMediaCallback(callback);
}