Java Code Examples for org.luaj.vm2.Varargs#checkfunction()

The following examples show how to use org.luaj.vm2.Varargs#checkfunction() . 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 5 votes vote down vote up
public Varargs invoke(Varargs args) {
    LuaValue func = args.checkfunction(1);
    int up = args.checkint(2);
    if (func instanceof LuaClosure) {
        LuaClosure c = (LuaClosure) func;
        LuaString name = findupvalue(c, up);
        if (name != null) {
            return varargsOf(name, c.upValues[up - 1].getValue());
        }
    }
    return NIL;
}
 
Example 2
Source File: DebugLib.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
public Varargs invoke(Varargs args) {
    LuaValue func = args.checkfunction(1);
    int up = args.checkint(2);
    LuaValue value = args.arg(3);
    if (func instanceof LuaClosure) {
        LuaClosure c = (LuaClosure) func;
        LuaString name = findupvalue(c, up);
        if (name != null) {
            c.upValues[up - 1].setValue(value);
            return name;
        }
    }
    return NIL;
}
 
Example 3
Source File: DebugLib.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
public Varargs invoke(Varargs args) {
    LuaValue func = args.checkfunction(1);
    int up = args.checkint(2);
    if (func instanceof LuaClosure) {
        LuaClosure c = (LuaClosure) func;
        if (c.upValues != null && up > 0 && up <= c.upValues.length) {
            return valueOf(c.upValues[up - 1].hashCode());
        }
    }
    return NIL;
}
 
Example 4
Source File: DebugLib.java    From XPrivacyLua with GNU General Public License v3.0 5 votes vote down vote up
public Varargs invoke(Varargs args) {
	LuaValue func = args.checkfunction(1);
	int up = args.checkint(2);
	if ( func instanceof LuaClosure ) {
		LuaClosure c = (LuaClosure) func;
		LuaString name = findupvalue(c, up);
		if ( name != null ) {
			return varargsOf(name, c.upValues[up-1].getValue() );
		}
	}
	return NIL;
}
 
Example 5
Source File: DebugLib.java    From XPrivacyLua with GNU General Public License v3.0 5 votes vote down vote up
public Varargs invoke(Varargs args) {
	LuaValue func = args.checkfunction(1);
	int up = args.checkint(2);
	LuaValue value = args.arg(3);
	if ( func instanceof LuaClosure ) {
		LuaClosure c = (LuaClosure) func;
		LuaString name = findupvalue(c, up);
		if ( name != null ) {
			c.upValues[up-1].setValue(value);
			return name;
		}
	}
	return NIL;
}
 
Example 6
Source File: DebugLib.java    From XPrivacyLua with GNU General Public License v3.0 5 votes vote down vote up
public Varargs invoke(Varargs args) {
	LuaValue func = args.checkfunction(1);
	int up = args.checkint(2);
	if ( func instanceof LuaClosure ) {
		LuaClosure c = (LuaClosure) func;
		if ( c.upValues != null && up > 0 && up <= c.upValues.length ) {
			return valueOf(c.upValues[up-1].hashCode());
		}
	}
	return NIL;
}
 
Example 7
Source File: DebugLib.java    From HtmlNative with Apache License 2.0 5 votes vote down vote up
public Varargs invoke(Varargs args) {
	LuaValue func = args.checkfunction(1);
	int up = args.checkint(2);
	if ( func instanceof LuaClosure ) {
		LuaClosure c = (LuaClosure) func;
		LuaString name = findupvalue(c, up);
		if ( name != null ) {
			return varargsOf(name, c.upValues[up-1].getValue() );
		}
	}
	return NIL;
}
 
Example 8
Source File: DebugLib.java    From HtmlNative with Apache License 2.0 5 votes vote down vote up
public Varargs invoke(Varargs args) {
	LuaValue func = args.checkfunction(1);
	int up = args.checkint(2);
	LuaValue value = args.arg(3);
	if ( func instanceof LuaClosure ) {
		LuaClosure c = (LuaClosure) func;
		LuaString name = findupvalue(c, up);
		if ( name != null ) {
			c.upValues[up-1].setValue(value);
			return name;
		}
	}
	return NIL;
}
 
Example 9
Source File: DebugLib.java    From HtmlNative with Apache License 2.0 5 votes vote down vote up
public Varargs invoke(Varargs args) {
	LuaValue func = args.checkfunction(1);
	int up = args.checkint(2);
	if ( func instanceof LuaClosure ) {
		LuaClosure c = (LuaClosure) func;
		if ( c.upValues != null && up > 0 && up <= c.upValues.length ) {
			return valueOf(c.upValues[up-1].hashCode());
		}
	}
	return NIL;
}
 
Example 10
Source File: DebugLib.java    From luaj with MIT License 5 votes vote down vote up
public Varargs invoke(Varargs args) {
	LuaValue func = args.checkfunction(1);
	int up = args.checkint(2);
	if ( func instanceof LuaClosure ) {
		LuaClosure c = (LuaClosure) func;
		LuaString name = findupvalue(c, up);
		if ( name != null ) {
			return varargsOf(name, c.upValues[up-1].getValue() );
		}
	}
	return NIL;
}
 
Example 11
Source File: DebugLib.java    From luaj with MIT License 5 votes vote down vote up
public Varargs invoke(Varargs args) {
	LuaValue func = args.checkfunction(1);
	int up = args.checkint(2);
	LuaValue value = args.arg(3);
	if ( func instanceof LuaClosure ) {
		LuaClosure c = (LuaClosure) func;
		LuaString name = findupvalue(c, up);
		if ( name != null ) {
			c.upValues[up-1].setValue(value);
			return name;
		}
	}
	return NIL;
}
 
Example 12
Source File: DebugLib.java    From luaj with MIT License 5 votes vote down vote up
public Varargs invoke(Varargs args) {
	LuaValue func = args.checkfunction(1);
	int up = args.checkint(2);
	if ( func instanceof LuaClosure ) {
		LuaClosure c = (LuaClosure) func;
		if ( c.upValues != null && up > 0 && up <= c.upValues.length ) {
			return valueOf(c.upValues[up-1].hashCode());
		}
	}
	return NIL;
}
 
Example 13
Source File: StringLib.java    From luaj with MIT License 5 votes vote down vote up
public Varargs invoke(Varargs args) {
	LuaValue f = args.checkfunction(1);
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	try {
		DumpState.dump( ((LuaClosure)f).p, baos, args.optboolean(2, true) );
		return LuaString.valueUsing(baos.toByteArray());
	} catch (IOException e) {
		return error( e.getMessage() );
	}
}