local variable

Ken Ray kray at sonsothunder.com
Wed Oct 9 12:18:01 EDT 2002


> My script goes as follow :
>
> local theDay, TheMonth, TheYear
> ...
> ...
>
> -- I put a variable into L, set itemdel to tab and check item 1 of L
> if it is a date (european format)
>
>   if matchtext( item 1 of
>
L,"(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/([0-9][0-9])",theDay,TheMonth,Th
eYear)
> is true then
>           ...
> end if
>
>
> but I have to run the same code further in the same script. about
> another line in another field.
>
> My question :
>
> do I have to reset the variable theDay, TheMonth, TheYear to empty
> before calling again the same code
>   if matchtext( item 1 of
>
L,"(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[0-2])/([0-9][0-9])",theDay,TheMonth,Th
eYear)
> is true then
>           ...
> end if

No, you just have to have them defined as locals some time before the
matchText() call. This is because the variables need to be there for
matchText to fill them up.

> Thanks for your help.

My pleasure!

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/




More information about the use-livecode mailing list