Java Code Examples for org.luaj.vm2.LuaValue#valueOf()
The following examples show how to use
org.luaj.vm2.LuaValue#valueOf() .
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: LVHttpPlugin.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 6 votes |
private static Varargs startConnect(Varargs args, LVHttpBridge lvHttpBridge, RequestType requestType) { final int fixIndex = VenvyLVLibBinder.fixIndex(args); int requestId = -1; if (args.narg() > fixIndex) { String url = LuaUtil.getString(args, fixIndex + 1); LuaTable table = LuaUtil.getTable(args, fixIndex + 2); LuaFunction callback = LuaUtil.getFunction(args, fixIndex + 3); switch (requestType) { case GET: requestId = lvHttpBridge.get(url, table, callback); break; case POST: requestId = lvHttpBridge.post(url, table, callback); break; case PUT: requestId = lvHttpBridge.put(url, table, callback); break; case DELETE: requestId = lvHttpBridge.delete(url, table, callback); break; } } return LuaValue.valueOf(requestId); }
Example 2
Source File: LVCompressPlugin.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 6 votes |
@Override public Varargs invoke(Varargs args) { try { int fixIndex = VenvyLVLibBinder.fixIndex(args); LuaValue zipFilePath = args.arg(fixIndex + 1); //key String filePath = luaValueToString(zipFilePath); LuaValue targetPath = args.arg(fixIndex + 2); //key String out = luaValueToString(targetPath); if (!TextUtils.isEmpty(filePath) && !TextUtils.isEmpty(out)) { long value = VenvyGzipUtil.unzipFile(filePath, out,true); return LuaValue.valueOf(value); } } catch (Exception e) { VenvyLog.e(LVCompressPlugin.class.getName(), e); } return LuaValue.NIL; }
Example 3
Source File: LexState.java From luaj with MIT License | 5 votes |
boolean str2d(String str, SemInfo seminfo) { if (str.indexOf('n')>=0 || str.indexOf('N')>=0) seminfo.r = LuaValue.ZERO; else if (str.indexOf('x')>=0 || str.indexOf('X')>=0) seminfo.r = strx2number(str, seminfo); else { try { seminfo.r = LuaValue.valueOf(Double.parseDouble(str.trim())); } catch (NumberFormatException e) { lexerror("malformed number (" + e.getMessage() + ")", TK_NUMBER); } } return true; }
Example 4
Source File: LVRSAPlugin.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
@Override public LuaValue invoke(Varargs args) { int fixIndex = VenvyLVLibBinder.fixIndex(args); LuaValue dataValue = args.arg(fixIndex + 1); //data LuaValue publicKeyValue = args.arg(fixIndex + 2); //publicKey String data = VenvyLVLibBinder.luaValueToString(dataValue); String publicKey = VenvyLVLibBinder.luaValueToString(publicKeyValue); String rsa = VenvyRSAUtil.encryptByRSA(data, publicKey); return LuaValue.valueOf(rsa == null ? "" : rsa); }
Example 5
Source File: LexState.java From XPrivacyLua with GNU General Public License v3.0 | 5 votes |
boolean str2d(String str, SemInfo seminfo) { if (str.indexOf('n')>=0 || str.indexOf('N')>=0) seminfo.r = LuaValue.ZERO; else if (str.indexOf('x')>=0 || str.indexOf('X')>=0) seminfo.r = strx2number(str, seminfo); else seminfo.r = LuaValue.valueOf(Double.parseDouble(str.trim())); return true; }
Example 6
Source File: VenvyUDHttpRequestCallback.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public LuaValue abort(Varargs varargs) { final int fixIndex = VenvyLVLibBinder.fixIndex(varargs); if (varargs.narg() > fixIndex) { Integer requestId = LuaUtil.getInt(varargs, 2); return valueOf(requestId != null && httpBridge != null && httpBridge.abort(requestId)); } return LuaValue.valueOf(false); }
Example 7
Source File: LuaMappingWorld.java From Cubes with MIT License | 5 votes |
@Override public LuaValue call(LuaValue arg1, LuaValue arg2, LuaValue arg3) { int x = arg1.checkint(); int y = arg2.checkint(); int z = arg3.checkint(); return LuaValue.valueOf(world.getLightRaw(x, y, z)); }
Example 8
Source File: UDApplet.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
@Override public Varargs invoke(Varargs args) { if (platform != null && platform.getAppletListener() != null) { return LuaValue.valueOf(platform.getAppletListener().canGoBack()); } return LuaValue.valueOf(true); }
Example 9
Source File: LVWebViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
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 10
Source File: LVVideoPlugin.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
@Override public Varargs invoke(Varargs args) { return mPlatform != null ? LuaValue.valueOf(mPlatform.getPlatformInfo().getAppKey()) : LuaValue.NIL; }
Example 11
Source File: LVVideoPlugin.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
@Override public Varargs invoke(Varargs args) { return mPlatform != null && mPlatform.getPlatformInfo().getThirdPlatformId() != null ? LuaValue.valueOf(mPlatform.getPlatformInfo().getThirdPlatformId()) : LuaValue.NIL; }
Example 12
Source File: LVVideoPlugin.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
@Override public Varargs invoke(Varargs args) { return mPlatform != null && mPlatform.getPlatformInfo().getVideoId() != null ? LuaValue.valueOf(mPlatform.getPlatformInfo().getVideoId()) : LuaValue.NIL; }
Example 13
Source File: LVPlayerPlugin.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
@Override public Varargs invoke(Varargs args) { return mPlatform != null && mPlatform.getMediaControlListener() != null ? LuaValue.valueOf(mPlatform.getMediaControlListener().getCurrentPosition()) : LuaValue.valueOf(0); }
Example 14
Source File: LVDevicePlugin.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
@Override public Varargs invoke(Varargs args) { return LuaValue.valueOf(VenvyUIUtil.isScreenOriatationPortrait(App.getContext())); }
Example 15
Source File: LuaValueTest.java From HtmlNative with Apache License 2.0 | 4 votes |
@Test public void testString() { System.out.println("\ntestString"); LuaValue value = LuaValue.valueOf("hello world"); println(value); }
Example 16
Source File: JavaArray.java From luaj with MIT License | 4 votes |
public LuaValue call(LuaValue u) { return LuaValue.valueOf(Array.getLength(((LuaUserdata)u).m_instance)); }
Example 17
Source File: LVVideoPlugin.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
@Override public Varargs invoke(Varargs args) { return mPlatform != null && mPlatform.getPlatformInfo() != null && !TextUtils.isEmpty(mPlatform.getPlatformInfo().getAppSecret()) ? LuaValue.valueOf(mPlatform.getPlatformInfo().getAppSecret()) : LuaValue.valueOf(cn.com.venvy.AppSecret.getAppSecret(mPlatform)); }
Example 18
Source File: LVWebViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LuaValue callJS(U view, Varargs varargs) { String jsMethod = LuaUtil.getString(varargs, 2); final LuaFunction callback = LuaUtil.getFunction(varargs, 3); return LuaValue.valueOf(view.callJS(jsMethod, callback)); }
Example 19
Source File: LVWebViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
@LuaViewApi(since = VmVersion.V_530) public LuaValue isLoading(U view, Varargs varargs) { return LuaValue.valueOf(view.isLoading()); }
Example 20
Source File: LuaConversion.java From Cubes with MIT License | 4 votes |
@Override public LuaValue toLua(Character aCharacter) { return LuaValue.valueOf(aCharacter); }