Java Code Examples for org.luaj.vm2.Varargs#arg1()
The following examples show how to use
org.luaj.vm2.Varargs#arg1() .
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: BaseLib.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public Varargs invoke(Varargs args) { LuaValue ld = args.arg1(); args.argcheck(ld.isstring() || ld.isfunction(), 1, "ld must be string or function"); String source = args.optjstring(2, ld.isstring() ? ld.tojstring() : "=(load)"); String mode = args.optjstring(3, "bt"); LuaValue env = args.optvalue(4, globals); return loadStream(ld.isstring() ? ld.strvalue().toInputStream() : new StringInputStream(ld.checkfunction()), source, mode, env); }
Example 2
Source File: LuaJavaCoercionTest.java From luaj with MIT License | 5 votes |
public void testExceptionMessage() { String script = "local c = luajava.bindClass( \""+SomeClass.class.getName()+"\" )\n" + "return pcall( c.someMethod, c )"; Varargs vresult = globals.get("load").call(LuaValue.valueOf(script)).invoke(LuaValue.NONE); LuaValue status = vresult.arg1(); LuaValue message = vresult.arg(2); assertEquals( LuaValue.FALSE, status ); int index = message.toString().indexOf( "this is some message" ); assertTrue( "bad message: "+message, index>=0 ); }
Example 3
Source File: BaseLib.java From luaj with MIT License | 5 votes |
public Varargs invoke(Varargs args) { LuaValue ld = args.arg1(); if (!ld.isstring() && !ld.isfunction()) { throw new LuaError("bad argument #1 to 'load' (string or function expected, got " + ld.typename() + ")"); } String source = args.optjstring(2, ld.isstring()? ld.tojstring(): "=(load)"); String mode = args.optjstring(3, "bt"); LuaValue env = args.optvalue(4, globals); return loadStream(ld.isstring()? ld.strvalue().toInputStream(): new StringInputStream(ld.checkfunction()), source, mode, env); }
Example 4
Source File: MathLib.java From luaj with MIT License | 5 votes |
public Varargs invoke(Varargs args) { LuaValue n = args.arg1(); /* number is its own integer part, no fractional part */ if (n.islong()) return varargsOf(n, valueOf(0.0)); double x = n.checkdouble(); /* integer part (rounds toward zero) */ double intPart = ( x > 0 ) ? Math.floor( x ) : Math.ceil( x ); /* fractional part (test needed for inf/-inf) */ double fracPart = x == intPart ? 0.0 : x - intPart; return varargsOf( valueOf(intPart), valueOf(fracPart) ); }
Example 5
Source File: DebugLib.java From luaj with MIT License | 5 votes |
public Varargs invoke(Varargs args) { Object o = args.checkuserdata(1); LuaValue v = args.checkvalue(2); LuaUserdata u = (LuaUserdata) args.arg1(); u.m_instance = v.checkuserdata(); u.m_metatable = v.getmetatable(); return NONE; }
Example 6
Source File: BaseLib.java From HtmlNative with Apache License 2.0 | 5 votes |
public Varargs invoke(Varargs args) { LuaValue ld = args.arg1(); args.argcheck(ld.isstring() || ld.isfunction(), 1, "ld must be string or function"); String source = args.optjstring(2, ld.isstring() ? ld.tojstring() : "=(load)"); String mode = args.optjstring(3, "bt"); LuaValue env = args.optvalue(4, globals); return loadStream(ld.isstring() ? ld.strvalue().toInputStream() : new StringInputStream(ld.checkfunction()), source, mode, env); }
Example 7
Source File: DebugLib.java From HtmlNative with Apache License 2.0 | 5 votes |
public Varargs invoke(Varargs args) { Object o = args.checkuserdata(1); LuaValue v = args.checkvalue(2); LuaUserdata u = (LuaUserdata) args.arg1(); u.m_instance = v.checkuserdata(); u.m_metatable = v.getmetatable(); return NONE; }
Example 8
Source File: BaseLib.java From XPrivacyLua with GNU General Public License v3.0 | 5 votes |
public Varargs invoke(Varargs args) { LuaValue ld = args.arg1(); args.argcheck(ld.isstring() || ld.isfunction(), 1, "ld must be string or function"); String source = args.optjstring(2, ld.isstring()? ld.tojstring(): "=(load)"); String mode = args.optjstring(3, "bt"); LuaValue env = args.optvalue(4, globals); return loadStream(ld.isstring()? ld.strvalue().toInputStream(): new StringInputStream(ld.checkfunction()), source, mode, env); }
Example 9
Source File: DebugLib.java From XPrivacyLua with GNU General Public License v3.0 | 5 votes |
public Varargs invoke(Varargs args) { Object o = args.checkuserdata(1); LuaValue v = args.checkvalue(2); LuaUserdata u = (LuaUserdata) args.arg1(); u.m_instance = v.checkuserdata(); u.m_metatable = v.getmetatable(); return NONE; }
Example 10
Source File: XLua.java From XPrivacyLua with GNU General Public License v3.0 | 5 votes |
LuaLocals(Globals globals) { this.presize(globals.length(), 0); Varargs entry = globals.next(LuaValue.NIL); while (!entry.arg1().isnil()) { LuaValue key = entry.arg1(); LuaValue value = entry.arg(2); super.rawset(key, value); entry = globals.next(entry.arg1()); } }
Example 11
Source File: LVCustomViewPagerIndicator.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public LVCustomViewPagerIndicator(Globals globals, LuaValue metaTable, Varargs varargs) { super(globals.getContext()); this.mInitParams = varargs != null ? varargs.arg1() : null; this.mLuaUserdata = new UDCustomViewPagerIndicator(this, globals, metaTable, this.mInitParams); this.mLayout = new IcsLinearLayout(globals.getContext(), R.attr.lv_vpiIconPageIndicatorStyle); this.setHorizontalScrollBarEnabled(false); super.addView(mLayout, LuaViewUtil.createRelativeLayoutParamsMM()); }
Example 12
Source File: DebugLib.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public Varargs invoke(Varargs args) { Object o = args.checkuserdata(1); LuaValue v = args.checkvalue(2); LuaUserdata u = (LuaUserdata) args.arg1(); u.m_instance = v.checkuserdata(); u.m_metatable = v.getmetatable(); return NONE; }
Example 13
Source File: VenvyLVLibBinder.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public static int fixIndex(Varargs args) { return args != null && args.arg1() instanceof VenvyLVLibBinder ? 1 : 0; }
Example 14
Source File: LVGradientView.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LVGradientView(Globals globals, LuaValue metaTable, Varargs varargs) { super(globals.getContext()); mLuaUserdata = new UDGradientView(this, globals, metaTable, varargs != null ? varargs.arg1() : null); }
Example 15
Source File: VenvyMediaPlayerView.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public VenvyMediaPlayerView(Globals globals, LuaValue metaTable, Varargs varargs) { super(globals.getContext()); mLuaUserdata = new VenvyUDMediaPlayerView(this, globals, metaTable, varargs != null ? varargs.arg1() : null); init(getContext()); }
Example 16
Source File: UDFile.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
private int fixIndex(Varargs args) { return args != null && args.arg1() instanceof UDFile ? 1 : 0; }
Example 17
Source File: LVHorizontalScrollView.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LVHorizontalScrollView(Globals globals, LuaValue metaTable, Varargs varargs) { super(globals.getContext()); this.mLuaUserdata = new UDHorizontalScrollView(this, globals, metaTable, varargs != null ? varargs.arg1() : null); init(globals); }
Example 18
Source File: LVScrollView.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LVScrollView(Globals globals, LuaValue metaTable, Varargs varargs) { super(globals.getContext()); this.mLuaUserdata = new UDScrollView(this, globals, metaTable, varargs != null ? varargs.arg1() : null); init(globals); }
Example 19
Source File: LVRefreshLayout.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LVRefreshLayout(Globals globals, LuaValue metaTable, Varargs varargs) { super(globals.getContext()); this.mLuaUserdata = new UDRefreshLayout(this, globals, metaTable, varargs != null ? varargs.arg1() : null); init(globals); }
Example 20
Source File: BaseMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 2 votes |
/** * 获取userdata * * @param varargs * @return */ public U getUD(Varargs varargs) { return (U) varargs.arg1(); }