dotdotdot
Type
operator
Summary
Indicates the remaining arguments to a handler call should be taken from a sequence array.
Syntax
<handlerName> [<argumentsList>], ... <array>
<handlerName>([<argumentsList>], ... <array>)
Description
Use the ...
operator to indicate that the remaining arguments to a handler
call should be taken from a sequence array (an array with all numeric keys
from one up to the number of elements in the array).
The arguments passed to a handler when the ... operator is used consists of any explicitly specified arguments, followed by those taken from the provided array in order.
For example:
on mouseUp
MyHandler \"foo\", ... [ 1, 2, 3 ]
end mouseUp
command MyHandler pName, pA, pB, pC
answer pName && pA && pB && pC
end MyHandler
Here the call to MyHandler
will have four arguments - the last three being
taken from elements 1, 2 and 3 of the specified sequence array.
Just as with explicitly specified arguments, there can be more elements in the sequence array than there are named parameters to bind to in the called handler. Any such arguments are available in the called handler using the param function in the normal way.
For example:
on mouseUp
MyHandler \"foo\", ... [ 1, 2, 3 ]
end mouseUp
command MyHandler pName
answer pName && param(2) && param(3) && param(4)
end mouseUp
Here the arguments specified via ...
are available as the 2nd, 3rd and 4th
parameters accessible via param.
The ...
operator may only be used when calling LiveCode Script
handlers, it cannot be used in calls to engine functions, engine commands, lcb
handlers or external handlers.
Parameters
Name | Type | Description |
---|---|---|
handlerName | The name of the called handler | |
argumentsList | One or more arguments passed to the handler, separated by commas | |
array | A sequence array, or expression evaluating to a sequence array, containing further arguments to be passed to the handler |
Examples
on mouseUp
put "argument-2" into tArray[1]
put "argument-3" into tArray[2]
myCommand "argument-1", ... tArray
end mouseUp
command myCommand pA, pB, pC
end myCommand
on mouseUp
put "argument-2" into tArray[1]
put "argument-3" into tArray[2]
get myFunction("argument-1", ... tArray)
end mouseUp
function myFunction pA, pB, pC
end myFunction
Related
control structure: on, function
function: paramCount, param
Compatibility and Support
Introduced
LiveCode 10.0
OS
mac
windows
linux
ios
android
web
Platforms
desktop
server
mobile