Background info first regarding how I scope variables (rightly or wrongly).
I scope my variables in every file by declaring them inside an if endif statement at the start and end of the file. Variables that are required to be accessible outside of this are in tables that are declared as Global.
I have a local variable called show the variable appears to change within a switch and I don't know if this is a bug or not.
here is the switch statement inside the
Code: Select all
local function _logicCode: Select all
DebugPrint ("\t<SWITCH>", show)
Switch (show)
Case #SHOW_STAGE:
ProcessStageSelect ()
Break
Case #SHOW_OPTIONS:
Options.Process ()
Break
Case #SHOW_STATS:
Stats.Process ()
Break
Case #SHOW_MEDALS:
MedalsDisplay.Process ()
Break
Default:
Widgets.Process ("title")
Break
EndSwitch
DebugPrint ("\t</SWITCH>", show)
from the output --> is the entry point to a function and <-- is the exit point to a function. Next is the FILE the function belongs to and the parameters passed to it.
e.g.
--> TITLE:Local Function _logic () 2
Refers to entry point to the locally declared function _login within the file TITLE. The number afterwards is the value of show. I normally only show the variables of the passed in parameters, but for this debug session I am showing the value of show so I could see what changes were made to the variable.
TITLE refers to functions executed from the file title.hws and OPTIONS refers to the functions executed from the file options.hws.
Now the output from the session and you will see the value of show change from 2 to 5 then within the <SWITCH> </SWITCH> block it changes from 5 to 2. Show is evaluated within the switch block and exectues the function Widgets.Process which is in another file WIDGETS that does not have scope to the local variable show and should does not reference or change it.
Code: Select all
--> TITLE:Local Function _logic () 2
<SWITCH> 2
--> OPTIONS:Local Function _back ()
--> TITLE:Local Function _backFromOptions () 2
<-- TITLE:EndFunction _backFromOptions () 5
<-- OPTIONS:EndFunction _back ()
</SWITCH> 5
<-- TITLE:EndFunction _logic () 5
--> TITLE:Local Function _logic () 5
<SWITCH> 5
</SWITCH> 2
<-- TITLE:EndFunction _logic () 2
Regards,
Dwayne