View Full Version : Local variable?
tin3tin
6th May 2007, 12:16
I'm working with the import function. Importing a script with variables with the same names as the main script(where the import function is used), is causing errors.
So is there a way to make a variable local so it will not affect the values of variables with the same name in the main script?
So is there a way to make a variable local so it will not affect the values of variables with the same name in the main script?
Since Import() basically just replaces itself with the contents of the other script I'm afraid not.
Prefixing all (global) variables used in the imported script with the script's name and an underscore would be good practice and would mostly prevent such problems, though...
np: Radical Face - Glory (Ghost)
foxyshadis
7th May 2007, 00:01
If it's a simple script with no functions, you might be able to do:
function myOtherScriptIsAScreenplay() {
Import("...")
}
Then call the function in your main one. I have no idea if this works, but it's worth a try. =D
tin3tin
7th May 2007, 08:04
That works!!!
:thanks:
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.