Is it possible, in script, to either define a class hierarchy or to pass a reference to a function or procedure as a parameter to another function or procedure?
Thanks in advance for your insight.
Cameron
Is it possible, in script, to either define a class hierarchy or to pass a reference to a function or procedure as a parameter to another function or procedure?
Thanks in advance for your insight.
Cameron
Hi Cameron,
I do not know if I got you correctly, but how about
// Called when RuntimeData (global variables shared among scripts) change.
// Set data with SetRuntimData(key, value);
procedure OnRuntimeDataChange(Key, Value: string);
begin
end;
Would that work for you?
Runtime regards
TSD
Thank you for the suggestions. It seems I failed to convey my meaning. I already use the technique you suggested to solve a different problem.
An example of what I was asking might loosely be expressed:
procedure workerA;
procedure workerB;
procedure doWork(worker : procedure_reference);
begin
while some_condition do
worker;
end;
// (Later I added that) this would be called along the lines of:
doWork(workerB);
This might be characterised as a procdural implementation of the visitor pattern.
I managed to solve my problem by putting the “worker” in a separate file from the one that will call it. I can therefore have multiple task-specific workers all with the same name.
Cameron