-
Notifications
You must be signed in to change notification settings - Fork 0
Builtins
Socratic_Phoenix edited this page Aug 21, 2017
·
7 revisions
Name | Params | Action |
---|---|---|
import | module | Attempts to import the given module. Throws an import error on failure. |
importFrom | module,field | Attempts to import the given field from the given module. Throws an import error on failure. |
get | object,field | Attempts to get the given field from the given object. Returns void if no field exist. |
set | object,field,value | Attempts to set the given field on the given object, to the given value. Returns the given value. |
del | object,field | Attempts to remove the given field from the given object. Returns void. |
fields | object | Returns an [iterable](standards#iterable] of all the currently set fields on the given object. |
has | object,field,params=void | If params void, returns true if the given object has the given field. If params is null, returns true if the given object has the given field, and that field is a function. If params is a number, returns true if the given object has the given field, that field is a function, and the number of required parameters of that function is the same as params. |
hasFunction | object,field,params=null | returns has(object, field, params)
|
paramCount | function | returns the number of parameters the given function has. |
reqParamCount | function | returns the number of required parameters the given function has. |
defParamCount | function | returns the number of default parameters the given function has. |
object | prints the given object to STDOUT | |
println | object | prints the given object, plus a newline, to STDOUT |
printErr | object | prints the given object to STDERR |
printlnErr | object | prints the given object to STDERR |
sleep | millis | Sleeps the current thread for the given amount of milliseconds. Throws an [interrupted error](standards#errors] if interrupted. |
Name | Params | Action |
---|---|---|
num | object | Attempts to convert the given object to a number, or, if unable, returns void. |
str | object | Attempts to convert the given object to a string, or, if unable, returns void. |
bool | object | Attempts to convert the given object to a boolean, or, if unable, returns void. |
array | object | Attempts to convert the given object to an array, or, if unable, returns void. |
char | object | Attempts to convert the given object to a number, then to a character, or, if unable, returns void. |
int32 | object | Attempts to convert the given object to a 32-bit integer, or, if unable, returns void. |
int64 | object | Attempts to convert the given object to a 64-bit integer, or, if unable, returns void. |
float64 | object | Attempts to convert the given object to a 64-bit decimal, or, if unable, returns void. |
newArray | length | Creates a new array with the given length. |
Name | Params | Action |
---|---|---|
error | name,message,cause=null,parents=null | Returns an error object with the given name, message, cause, and parents. Cause should be null or another error object, parents should be a string collection, and everything else should be a string. All error objects will automatically have "shnap.Error" added to their parents. |
ioError | message,cause=null | Returns an error object with the name "shnap.IOError" |
fileNotFoundError | message,cause=null | returns an error object with the name "shnap.FileNotFoundError" and the parent "shnap.IOError" |
typeError | message,cause=null | Returns an error object with the name "shnap.TypeError" |
returnTypeError | message,cause=null | Returns an error object with the name "shnap.ReturnTypeError" and the parent "shnap.TypeError" |
importError | message,cause=null | Returns an error object with the name "shnap.ImportError" |
invocationError | message,cause=null | Returns an error object with the name "shnap.InvocationError" |
parameterError | message,cause=null | Returns an error object with the name "shnap.ParameterError" and the parent "shnap.InvocationError" |
parameterSizeError | message,cause=null | Returns an error object with the name "shnap.ParameterSizeError" and the parents ["shnap.InvocationError", "shnap.ParameterError"] |
parameterMismatchError | message,cause=null | Returns an error object with the name "shnap.ParameterMismatchError" and the parents ["shnap.InvocationError", "shnap.ParameterError"] |
Name | Params | Action |
---|---|---|
range | x,y=null,step=1,inclusive=false | Returns an inclusive or exclusive range iterator from min to max, incrementing by step. If y is null, min will be 0 and x will be max. If y is nonnull, min will be x and y will be max. If inclusive is true, the range's last value will be <= max, otherwise the last value will be < max. |
infrange | start,step=1 | Returns an infinite range iterator, starting at start and increasing by step. |
iterableStr | iterable | Returns the string representation of an iterable value. Fails if the iterable is infinite or contains itself. |
iterator | hasNext, next | Returns an iterator with the given hasNext function and the given next function |
isIterator | object | returns true if the given object has the functions next and hasNext , both with 0 required arguments. |
isIterable | object | returns true if the given object has the function iterator or isIterator returns true |
Name | Params | Action |
---|---|---|
javaClass | name | Returns an object representing the given java class. |
javaArray | arr,component="java.lang.Object" | Returns an object representing a java array, with the given component type, populated with the given values. |
Home | New Issue | Contact Me