Hi I'm a C/C++ programmer doing some WAP programming for my University. I'm getting a bit confused by varibles in WML & WMLS. Are all varibles global to all the cards in the deck or local to one card only? How do I pass data between cards if the varibles are local? Please help me I've been through all the documentation I could find on the site and it does not seem to explain it!
Posted by Daniel Brown, email@example.com
on June 26, 2000 at 18:18
Posted by mario gianota, MarioGianota@SimultaneousMillions.com
on June 26, 2000 at 20:30
WML variables are stored within the browser's Browser Context. The context acts like a memory cache. When a variable is declared in WML or WMLS the name and value are loaded into the browser context and saved for future reference.
Any WML Deck can access a variable previously saved within the context simply by naming the variable. For example, $(myVar)
would cause the browser to substitute the value of the variable
named myVar with everything between the brackets.
Once a variable is in the browser context any WML Deck can
reference it by name (as can any WML Script).
All variables declared in WML have a global scope. Local
variable declaration is possible only through the WML Script.
In the case of the script, certain variables exist only within the
scope of the function.
If you're stuck for examples, try:
You'll find a whole bunch of WML and WML Script that makes
heavy use of variables. Including some examples that show
how to pass variables between the script and a card.