Java Code Examples for org.luaj.vm2.Varargs#optfunction()
The following examples show how to use
org.luaj.vm2.Varargs#optfunction() .
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: DebugLib.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 6 votes |
public Varargs invoke(Varargs args) { int a = 1; LuaThread t = args.isthread(a) ? args.checkthread(a++) : globals.running; LuaValue func = args.optfunction(a++, null); String str = args.optjstring(a++, ""); int count = args.optint(a++, 0); boolean call = false, line = false, rtrn = false; for (int i = 0; i < str.length(); i++) switch (str.charAt(i)) { case 'c': call = true; break; case 'l': line = true; break; case 'r': rtrn = true; break; } t.hookfunc = func; t.hookcall = call; t.hookline = line; t.hookcount = count; t.hookrtrn = rtrn; return NONE; }
Example 2
Source File: DebugLib.java From XPrivacyLua with GNU General Public License v3.0 | 6 votes |
public Varargs invoke(Varargs args) { int a=1; LuaThread t = args.isthread(a)? args.checkthread(a++): globals.running; LuaValue func = args.optfunction(a++, null); String str = args.optjstring(a++,""); int count = args.optint(a++,0); boolean call=false,line=false,rtrn=false; for ( int i=0; i<str.length(); i++ ) switch ( str.charAt(i) ) { case 'c': call=true; break; case 'l': line=true; break; case 'r': rtrn=true; break; } LuaThread.State s = t.state; s.hookfunc = func; s.hookcall = call; s.hookline = line; s.hookcount = count; s.hookrtrn = rtrn; return NONE; }
Example 3
Source File: DebugLib.java From HtmlNative with Apache License 2.0 | 6 votes |
public Varargs invoke(Varargs args) { int a=1; LuaThread t = args.isthread(a)? args.checkthread(a++): globals.running; LuaValue func = args.optfunction(a++, null); String str = args.optjstring(a++,""); int count = args.optint(a++,0); boolean call=false,line=false,rtrn=false; for ( int i=0; i<str.length(); i++ ) switch ( str.charAt(i) ) { case 'c': call=true; break; case 'l': line=true; break; case 'r': rtrn=true; break; } LuaThread.State s = t.state; s.hookfunc = func; s.hookcall = call; s.hookline = line; s.hookcount = count; s.hookrtrn = rtrn; return NONE; }
Example 4
Source File: DebugLib.java From luaj with MIT License | 6 votes |
public Varargs invoke(Varargs args) { int a=1; LuaThread t = args.isthread(a)? args.checkthread(a++): globals.running; LuaValue func = args.optfunction(a++, null); String str = args.optjstring(a++,""); int count = args.optint(a++,0); boolean call=false,line=false,rtrn=false; for ( int i=0; i<str.length(); i++ ) switch ( str.charAt(i) ) { case 'c': call=true; break; case 'l': line=true; break; case 'r': rtrn=true; break; } LuaThread.State s = t.state; s.hookfunc = func; s.hookcall = call; s.hookline = line; s.hookcount = count; s.hookrtrn = rtrn; return NONE; }
Example 5
Source File: UIImageViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public LuaValue setPlaceHolderImage(U view, Varargs varargs) { if (varargs.isstring(2)) { final String url = varargs.optjstring(2, null); final LuaFunction callback = varargs.optfunction(3, null); return view.setPlaceHolderImage(url, callback); } else if (varargs.arg(2) instanceof UDData) {//data final UDData data = (UDData) varargs.arg(2); return view.setPlaceHolderBytes(data != null ? Base64.decode(data.bytes(), Base64.NO_WRAP) : null); } return view; }
Example 6
Source File: UIImageViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
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 ? Base64.decode(data.bytes(), Base64.NO_WRAP) : null); } return view; }
Example 7
Source File: VenvyMqttMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public LuaValue mqttCallback(U target, Varargs varargs) { final LuaFunction callback = varargs.optfunction(2, null); if (callback != null && callback.isfunction()) { return target.setMqttCallback(callback); } return LuaValue.NIL; }
Example 8
Source File: VenvyNotificationMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public LuaValue registerNotification(U target, Varargs args) { if (args.narg() > 0) { final String tag = LuaUtil.getString(args, 2); final LuaFunction callback = args.optfunction(3, null); if (TextUtils.isEmpty(tag)) { return LuaValue.NIL; } if (callback != null && callback.isfunction()) { return target.registerNotification(callback, tag); } } return LuaValue.NIL; }
Example 9
Source File: VenvyKeyboardMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public LuaValue keyboardCallback(U target, Varargs varargs) { final LuaFunction callback = varargs.optfunction(2, null); if (callback != null && callback.isfunction()) { return target.setKeyboardCallback(callback); } return LuaValue.NIL; }
Example 10
Source File: VenvyAcrCloudMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public LuaValue acrRecognizeCallback(U target, Varargs varargs) { final LuaFunction callback = varargs.optfunction(2, null); if (callback != null && callback.isfunction()) { return target.setAcrCloudCallback(callback); } return LuaValue.NIL; }
Example 11
Source File: TimerMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LuaValue setCallback(U udTimer, Varargs varargs) { final LuaFunction callback = varargs.optfunction(2, null); return udTimer.setCallback(callback); }
Example 12
Source File: VenvyLVSvgeImageView.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public void svga(final Varargs varargs) { if (varargs.isstring(2)) { final String url = varargs.optjstring(2, null); mReadyToPlay = varargs.optfunction(3, null); if (iSvgaImageView == null) { return; } iSvgaImageView.parse(url, new ISvgaParseCompletion() { @Override public void onComplete(Object videoItem) { try { Class videoItemClass = videoItem.getClass(); Field fpsField = videoItemClass.getDeclaredField("FPS"); Field framesField = videoItemClass.getDeclaredField("frames"); if (fpsField != null) { fps = fpsField.getInt(videoItem); frames = framesField.getInt(videoItem); } if (mReadyToPlay != null) { LuaUtil.callFunction(mReadyToPlay); } else { iSvgaImageView.startAnimation(); } } catch (Exception e) { VenvyLog.e(VenvyLVSvgeImageView.class.getName(), e); } } @Override public void onError() { } }); iSvgaImageView.setCallback(new SVGACallback() { @Override public void onPause() { LuaUtil.callFunction(mOnPause); } @Override public void onFinished() { LuaUtil.callFunction(mOnFinished); } @Override public void onRepeat() { LuaUtil.callFunction(mOnRepeat); } @Override public void onStep(int i, double v) { LuaUtil.callFunction(mOnStep, LuaValue.valueOf(i)); } }); } }
Example 13
Source File: VenvyLVSvgeImageView.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public void readyToPlay(Varargs varargs) { mReadyToPlay = varargs.optfunction(2, null); }