Re: scope problem
- Posted by DerekParnell (admin) Sep 06, 2008
- 973 views
canadiancoder said...
I am not using SVN, and chars.e and equip.e include each other.
Ok, so now we can guess you are using v3.1 and "include each other" is a definite issue which wasn't mentioned before.
In version 3, even though you can have files include each other, you still can't reference something before Euphoria has seen its declaration.
One way to get around this is to extract the stuff that is commonly needed in both files into a third file.
-- constants.e -- global constant Name = 1, Weapon = 5
-- characters.e -- include constants.e Character = { "Lothar the Brave ", 34, 56, 43, "Long Sword"}
-- items.e -- include constants.e include characters.e procedure ArmCharacter( sequence chr ) .. some code... printf(1, "Your current weapon is: %s", { c[Weapon] } ) end procedure
This issue has been solved in v4.0. With version 4 you can freely include each other without having this problem.