Let LuaValue.checkfunction() return a LuaFunction
This commit is contained in:
@@ -50,7 +50,7 @@ public class LuaFunction extends LuaValue {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LuaValue checkfunction() {
|
public LuaFunction checkfunction() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -650,8 +650,7 @@ public class LuaValue extends Varargs {
|
|||||||
/** Check that optional argument is a function and return as {@link LuaFunction}
|
/** Check that optional argument is a function and return as {@link LuaFunction}
|
||||||
* <p>
|
* <p>
|
||||||
* A {@link LuaFunction} may either be a Java function that implements
|
* A {@link LuaFunction} may either be a Java function that implements
|
||||||
* functionality directly in Java,
|
* functionality directly in Java, or a {@link LuaClosure}
|
||||||
* or a {@link LuaClosure}
|
|
||||||
* which is a {@link LuaFunction} that executes lua bytecode.
|
* which is a {@link LuaFunction} that executes lua bytecode.
|
||||||
* @param defval {@link LuaFunction} to return if {@code this} is nil or none
|
* @param defval {@link LuaFunction} to return if {@code this} is nil or none
|
||||||
* @return {@code this} cast to {@link LuaFunction} if a function,
|
* @return {@code this} cast to {@link LuaFunction} if a function,
|
||||||
@@ -862,15 +861,14 @@ public class LuaValue extends Varargs {
|
|||||||
|
|
||||||
/** Check that the value is a function , or throw {@link LuaError} if not
|
/** Check that the value is a function , or throw {@link LuaError} if not
|
||||||
* <p>
|
* <p>
|
||||||
* A function is considered anything whose {@link type()} returns {@link TFUNCTION}.
|
* A {@link LuaFunction} may either be a Java function that implements
|
||||||
* In practice it will be either a built-in Java function, typically deriving from
|
* functionality directly in Java, or a {@link LuaClosure}
|
||||||
* {@link LuaFunction} or a {@link LuaClosure} which represents lua source compiled
|
* which is a {@link LuaFunction} that executes lua bytecode.
|
||||||
* into lua bytecode.
|
* @return {@code this} if it is a lua function or closure
|
||||||
* @return {@code this} if if a lua function or closure
|
|
||||||
* @throws LuaError if not a function
|
* @throws LuaError if not a function
|
||||||
* @see #checkclosure()
|
* @see #checkclosure()
|
||||||
*/
|
*/
|
||||||
public LuaValue checkfunction() { argerror("function"); return null; }
|
public LuaFunction checkfunction() { argerror("function"); return null; }
|
||||||
|
|
||||||
|
|
||||||
/** Check that the value is a Globals instance, or throw {@link LuaError} if not
|
/** Check that the value is a Globals instance, or throw {@link LuaError} if not
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ public abstract class Varargs {
|
|||||||
* @return LuaValue that can be called if argument i is lua function or closure
|
* @return LuaValue that can be called if argument i is lua function or closure
|
||||||
* @exception LuaError if the argument is not a lua function or closure
|
* @exception LuaError if the argument is not a lua function or closure
|
||||||
* */
|
* */
|
||||||
public LuaValue checkfunction(int i) { return arg(i).checkfunction(); }
|
public LuaFunction checkfunction(int i) { return arg(i).checkfunction(); }
|
||||||
|
|
||||||
/** Return argument i as a java int value, discarding any fractional part, or throw an error if not a number.
|
/** Return argument i as a java int value, discarding any fractional part, or throw an error if not a number.
|
||||||
* @param i the index of the argument to test, 1 is the first argument
|
* @param i the index of the argument to test, 1 is the first argument
|
||||||
|
|||||||
Reference in New Issue
Block a user