Package com.scriptbasic.api
Interface Subroutine<R>
- All Known Implementing Classes:
Engine.Sub
public interface Subroutine<R>
Interface to manage a BASIC subroutine. An instance of this interface can be
acquired calling the method
ScriptBasic.subroutine(String). It is
also possible to get all the subroutines calling the method ScriptBasic.subroutines().- Author:
- Peter Verhas
-
Method Details
-
numberOfArguments
int numberOfArguments()- Returns:
- the number of arguments the subroutine expects when invoked
-
name
java.lang.String name()Get the name of the subroutine. Even though the instance of the interface is usually acquired knowing the name of the subroutine this method can be used to access this information.- Returns:
- the name of the subroutine
-
call
Call the subroutine.- Parameters:
args- the arguments passed to the subroutine- Returns:
- the return value of the subroutine
- Throws:
ScriptBasicException- when an BASIC error happens during the execution of the subroutine
-
call
Call a subroutine without any argument.- Returns:
- the return value of the subroutine
- Throws:
ScriptBasicException- in case of exception
-