Field content as parametres in a function

Brian Milby brian at milby7.com
Tue Nov 29 08:23:48 EST 2022


Your original is the same as:

put field «test» into tParam
answer testFunction(tParam)

So yes, whatever is placed as a parameter to a function is not expanded.  Think about doing the same thing with an arbitrary block of text in the field and what would be the expected result.

Brian Milby
brian at milby7.com

> On Nov 29, 2022, at 6:26 AM, Tore Nilsen via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> 
> 
>> 29. nov. 2022 kl. 12:08 skrev Alex Tweedly via use-livecode <use-livecode at lists.runrev.com>:
>> 
>> Yes, your description is correct (except for saying the behavior is "puzzling" :-)
>> 
>> The first case you are passing a single parameter (which happens to have commas in its current content). You could have said " .... paramcount() returns 1 as expected".
>> 
>> The second case you pass 5 values.
>> 
>> And the third case, as you say, expands the value first, so it becomes a call with 5 parameters.
>> 
>> Alex.
> 
> What is «puzzling» to me, among a whole lot of other things I fail to grasp, is why in the first example, the value in field «test» is treated as a single parameter, but in the last example it is treated as five parameters, since nothing has changed with the values in the field itself. I do however accept the reality of it, but I wanted to understand why this is the way it is. My original thinking was that by referencing the field as parameter, the values of the field would then become de facto parameters passed on to the function. I guess it is just another item in the long list of things I do not fully understand. :-) 
> 
> Best regards
> Tore
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


More information about the use-livecode mailing list