| function name | description |
|---|---|
| class | create a scripted class definition |
| classInfo | return information about a class definition |
| function | declare a script function |
| defun | define a script function or method |
| local | declare one or more variables which are local in scope to the current script function or method |
| global | declare one or more variables which are global in scope |
| create | create an object |
| createAux | create an object allowing the type of object to be determined at runtime |
| getInterface | get a given interface for an object |
. (dot operator) |
the dot operator is used to access object properties and to invoke object methods |
| export | export a global variable so that child threads inherit a copy of the value |
| isDefined | test if the global variable is defined |
| isFunction | test if the supplied Symbol represents a function |
| isClass | test if the supplied Symbol represents a class |
| join | join a list of objects together |
| length | calculate the length of the argument - can work on multiple object types |
| load | load a package of script definitions |
| loadLibrary | load a dynamic library and register the class and function definitions it contains |
| print the arguments, each on a new line | |
| printAux | print the arguments with no newlines added |
| printStackFrames | print the evaluation stack frames -- useful for debugging scripts |
| reverse | reverse the argument - works on multiple object types |
| scramble | scramble the supplied text |
| unscramble | unscramble the supplied text |
| typeOf | return the type of the argument |
| faceOf | return the interface no. of the argument |
| isEmpty | determine if the argument is empty -- many different data types have a sensible value for 'empty' |
classCreate a scripted class definition. The use of this function is described on the Object Definition page. in
classInfoReturn information about a class -- this is returned as a list with the following entries:
functionDeclare a script function. This is discussed further on the Script Function Definition page.
Arguments:
| returnType | Symbol |
| fnName | Symbol |
| parameters | List |
Return type: the empty List () is returned.
defunDefine a script function or method. This is discussed further on the Script Function Definition page.
localDeclare one or more variables which are local in scope to the current script function or method. Note that Carapace requires you to declare each variable used within a script function. If you attempt to use a variable you haven't declared, an Error will be thrown.
Arguments:
It takes 1 or more two-element Lists where each list is of the form:
( variableName variableClass )
Both variableName and variableClass are
symbols.
Note that the variableClass must have already been declared
-- eg. by loading a script which declares the
class.
Return type: the empty List () is returned.
globalDeclare one or more variables which are global in scope. Note that Carapace requires you to declare each global variable. If you attempt to use a global variable you haven't declared, an Error will be thrown.
Arguments:
It takes 1 or more two-element Lists where each list is of the form:
( globalVariableName variableClass )
Both globalVariableName and variableClass are
symbols, and globalVariableName must
start with two colons ::
Note that the variableClass must have already been declared
-- eg. by loading a script which declares the
class.
Return type: the empty List () is returned.
createCreate an object -- this is used to create both built-in and script objects. This is a lazy function in that it doesn't evaluate its first argument.
Arguments:
| objectTypeName | Symbol |
| ... | further arguments are dependent on the object being created |
Return type: the newly created object is returned.
createAuxCreate an object allowing the type of object to be determined at runtime. The value of the first argument is a string which names the object type to be made.
Arguments:
| objType | Symbol |
Return type: the newly created object is returned.
getInterfaceGet a given interface for an object. The interface can be identified by its name, its Guid or its number.
Arguments:
| obj | Object |
| interfaceNameOrId | String,
Integer,
Guid
|
Return type: the new interface is returned.
. (dot operator)The dot operator is used to access object properties and to invoke object methods. For further details, see the Carapace Script page.
exportExport a global variable so that child threads inherit a copy of the value.
The complete list of globals exported from this thread is held in the global
list ::ExportedGlobals.
Arguments:
This takes one or more arguments, each of which is a Symbol which is the name of the variable to export.
| globalVariableName | Symbol |
| ... | further symbols |
Return type: the empty List () is returned.
isDefinedTest if the variable is defined.
Arguments:
| name | Symbol |
Return type: if the symbol is defined, the Symbol which is the variable's type
otherwise the empty List () is returned.
isFunction
Test if the supplied Symbol represents a function.
Arguments:
| name | Symbol |
Return type: if the symbol is a function, the Symbol true
otherwise the empty List () is returned.
isClass
Test if the supplied Symbol represents a class.
Arguments:
| name | Symbol |
Return type: if the symbol is a class, the Symbol true
otherwise the empty List () is returned.
joinJoin a list of strings together.
Arguments:
| strings | List |
Return type: String
lengthCalculate the length of the argument - can work on multiple object types.
Arguments:
| obj | Object |
Return type: Integer
load
Load a package of script definitions. If an optional second argument
of the empty List () is supplied, then
the expressions in the file are not evaluated, and the result of the load
is the List of expressions is returned.
Arguments:
| filename | String |
| evaluate optional | Object |
Return type: Object - the value returned
is the result evaluating the final expression in the package.
loadLibraryLoad a dynamic library and register the class and function definitions it contains.
Arguments:
| filename | String |
Return type: the empty List () is returned.
printPrint the arguments, each on a new line.
Arguments:
This takes a variable number of arguments of any type.
Return type: the empty List () is returned.
printAuxPrint the arguments with no newlines added.
Arguments:
This takes a variable number of arguments of any type.
Return type: the empty List () is returned.
printStackFrames
Print the evaluation stack frames -- useful for debugging scripts.
The supplied frameName is one of the following values:
all -- print all frames
this -- print only the current frame
parent -- print only the parent (i.e. the caller's) stack frame
Arguments:
| frameName | String |
Return type: the empty List () is returned.
reverseReverse the argument - works the following types:
Arguments:
| obj | one of the above types |
Return type: returns an object of the same type as the supplied argument
scrambleScramble the supplied text. This modifies the first argument.
Arguments:
| data | Binary |
| key | String |
Return type: the empty List () is returned.
unscrambleUnscramble the supplied text. This modifies the first argument.
Arguments:
| data | Binary |
| key | String |
Return type: the empty List () is returned.
typeOfReturn the type of the argument. The supplied argument can be of any type.
Arguments:
| obj | Object |
Return type: String
This function can also be used to test the type of the argument -- ie. it acts as a predicate if the String name of the type expected is also supplied:
Arguments:
| obj | Object |
| expectedType | String |
Return type: Object
faceOfReturn the interface no. of the argument. The supplied argument can be of any type.
Arguments:
| obj | Object |
Return type: the empty List () is returned.
isEmptyDetermine if the argument is empty -- many different data types have a sensible value for 'empty' as follows:
| data type | empty value |
|---|---|
Integer | 0 |
Real | 0.0 |
String | "" |
Binary | 0x"" |
Unknown | contains a NULL IUnknown pointer |
Dispatch | contains a NULL IDispatch pointer |
Arguments:
| obj | Object |
Return type: the Symbol true
or the empty List () is returned.
| Contents | Index | Current topic: functions | Related topics: objects |