Search in sources :

Example 41 with Varargs

use of org.luaj.vm2.Varargs in project LuaViewSDK by alibaba.

the class UIRefreshRecyclerViewMethodMapper method initParams.

@Override
public Varargs initParams(U view, Varargs varargs) {
    Varargs ret = super.initParams(view, varargs);
    this.reload(view, varargs);
    return ret;
}
Also used : Varargs(org.luaj.vm2.Varargs)

Example 42 with Varargs

use of org.luaj.vm2.Varargs in project LuaViewSDK by alibaba.

the class NewIndexFunction method invoke.

@Override
public Varargs invoke(Varargs args) {
    LuaValue key = args.arg(2);
    Varargs newargs = varargsOf(args.arg(1), args.arg(3));
    LuaValue func = metatable.get(key);
    if (func.isfunction()) {
        // 函数调用
        func.invoke(newargs);
    } else {
        LogUtil.d("[LuaView error]", "property not fount :", key.toString());
    }
    return NONE;
}
Also used : Varargs(org.luaj.vm2.Varargs) LuaValue(org.luaj.vm2.LuaValue)

Example 43 with Varargs

use of org.luaj.vm2.Varargs in project LuaViewSDK by alibaba.

the class UIViewPagerMethodMapper method initParams.

@Override
public Varargs initParams(U view, Varargs varargs) {
    Varargs ret = super.initParams(view, varargs);
    this.reload(view, varargs);
    return ret;
}
Also used : Varargs(org.luaj.vm2.Varargs)

Example 44 with Varargs

use of org.luaj.vm2.Varargs in project LuaViewSDK by alibaba.

the class UIImageViewMethodMapper method setImage.

public LuaValue setImage(U view, Varargs varargs) {
    if (varargs.isstring(2)) {
        final String url = varargs.optjstring(2, null);
        final LuaFunction callback = varargs.optfunction(3, null);
        return view.setImageUrl(url, callback);
    } else if (varargs.arg(2) instanceof UDData) {
        // data
        final UDData data = (UDData) varargs.arg(2);
        return view.setImageBytes(data != null ? data.bytes() : null);
    } else if (varargs.arg(2) instanceof UDBitmap) {
        // bitmap
        final UDBitmap bitmap = (UDBitmap) varargs.arg(2);
        return view.setImageBitmap(bitmap);
    }
    return view;
}
Also used : UDData(com.taobao.luaview.userdata.kit.UDData) UDBitmap(com.taobao.luaview.userdata.kit.UDBitmap) LuaFunction(org.luaj.vm2.LuaFunction)

Example 45 with Varargs

use of org.luaj.vm2.Varargs in project LuaViewSDK by alibaba.

the class HttpMethodMapper method get.

/**
 * get请求
 *
 * @param http
 * @param varargs
 * @return
 */
public LuaValue get(U http, Varargs varargs) {
    final String url = LuaUtil.getString(varargs, 2);
    final LuaTable params = LuaUtil.getTable(varargs, 3, 2);
    final LuaFunction callback = LuaUtil.getFunction(varargs, 4, 3, 2);
    return http.get(url, params, callback);
}
Also used : LuaTable(org.luaj.vm2.LuaTable) LuaFunction(org.luaj.vm2.LuaFunction)

Aggregations

Varargs (org.luaj.vm2.Varargs)24 LuaTable (org.luaj.vm2.LuaTable)22 LuaValue (org.luaj.vm2.LuaValue)20 VarArgFunction (org.luaj.vm2.lib.VarArgFunction)16 LuaString (org.luaj.vm2.LuaString)10 LuaFunction (org.luaj.vm2.LuaFunction)5 LuaViewApi (com.taobao.luaview.fun.mapper.LuaViewApi)2 UDView (com.taobao.luaview.userdata.ui.UDView)2 List (java.util.List)2 LuanObjImage (net.schattenkind.androidLove.luan.obj.LuanObjImage)2 Buffer (org.luaj.vm2.Buffer)2 LuaThread (org.luaj.vm2.LuaThread)2 Point (android.graphics.Point)1 Sensor (android.hardware.Sensor)1 SoundPool (android.media.SoundPool)1 UDBitmap (com.taobao.luaview.userdata.kit.UDBitmap)1 UDData (com.taobao.luaview.userdata.kit.UDData)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1