Search in sources :

Example 6 with LuaFunction

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

the class DebugLib method onCall.

public void onCall(LuaFunction f) {
    LuaThread t = globals.running;
    callstack().onCall(f);
    if (t.inhook)
        return;
    if (t.hookcall && t.hookfunc != null)
        callHook(CALL, NIL);
}
Also used : LuaThread(org.luaj.vm2.LuaThread)

Example 7 with LuaFunction

use of org.luaj.vm2.LuaFunction 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)

Example 8 with LuaFunction

use of org.luaj.vm2.LuaFunction 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.setImageBitmap(data != null ? data.bytes() : null);
    }
    return view;
}
Also used : UDData(com.taobao.luaview.userdata.kit.UDData) LuaFunction(org.luaj.vm2.LuaFunction)

Aggregations

LuaFunction (org.luaj.vm2.LuaFunction)5 LuaTable (org.luaj.vm2.LuaTable)4 LuaValue (org.luaj.vm2.LuaValue)3 Varargs (org.luaj.vm2.Varargs)2 ViewGroup (android.view.ViewGroup)1 UDData (com.taobao.luaview.userdata.kit.UDData)1 ILVViewGroup (com.taobao.luaview.view.interfaces.ILVViewGroup)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Globals (org.luaj.vm2.Globals)1 LuaString (org.luaj.vm2.LuaString)1 LuaThread (org.luaj.vm2.LuaThread)1 VarArgFunction (org.luaj.vm2.lib.VarArgFunction)1