Bernard wrote:value()' functions.
value allows you to call a function or execute a script in an object (card, stack, etc.) other than the one active. However, the syntax tends to be a bit cumbersome to use.
Rather than value, I prefer to use a handler wrapper.
Code: Select all
on list.removeDuplicates pForceWord
put the listings of me into tList
put the item_del of me into tDelim
----
put list.removeDuplicates(tList, tDelim) into tList
---
set the listings of me to tList
end list.removeDuplicates
----
function list.removeDuplicates pList, pDelim
... processing ...
return tResult
end list.removeDuplicates
This way of doing forces me to think about how to organize my scripts into libraries and define data that should be part of the
API (Application Programming Interface)
Anything within the function is purely function dependent. Anything within the handler corresponds to data within the API (which would correspond in a "usual" program to variables defined as local or global).
This is not really about dynamic scripting. This is more about allowing a system of reusable libraries.
For what concerns dynamic scripting, as you may know, there is a limit set to the number of lines you can execute dynamically within a compiled application (either via "do" or via "set the script of object to ...").
Check out under "script" and "scriptLimits"
* the number of statements permitted when changing a script (normally 10 in a standalone application)
* the number of statements permitted in a do command (normally 10 in a standalone application)
* the number of stacks permitted in the stacksInUse (normally 50 in a standalone application)
* the number of objects permitted in the frontScripts and backScripts (normally 10 in a standalone application)
Note that the send technique illustrated above allows you to bypass the later limit and to set up a real system of reusable libraries, even in compiled applications.