SET LOCAL
From Lianjapedia
Contents
Purpose
Determines whether dynamically created variables are created as LOCAL
Syntax
SET LOCAL ON | OFF | (<expL>)
See Also
Dynamically Loadable Modules, ISSET(), LOCAL, LPARAMETERS, PARAMETERS, PRIVATE, PUBLIC, SET STRICT, TYPE()
Description
With SET LOCAL ON, any variables being created dynamically (SET STRICT must be OFF) are created as LOCAL variables rather than PRIVATE variables. This protects you from variable scoping issues. When LOCAL is ON the PARAMETERS statement is also treated as a LPARAMETERS statement. By default, SET LOCAL is ON.
Introduced in Lianja v4.1.
Example
function calledfunc if isset(cVar1) // returns .F. ? cVar1 endif if isset(cVar2) // returns .T. ? cVar2 endif endfunc set local on // default cVar1 = "I'm local" private cVar2 cVar2 = "I'm private" calledfunc()