SA-MP Forums Archive
local variable "string" shadows a variable - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: local variable "string" shadows a variable (/showthread.php?tid=484929)



local variable "string" shadows a variable - TudvariHUN - 02.01.2014

Sziasztok!

The stack/heap used too much memory so I had to move the login/register system to the dialog.But after I pasted it under the dialog,a lot of warnings/errors appeared.I know what does the error/warning means,but it should be working well,but somehow it's not.


: warning 219: local variable "string" shadows a variable at a preceding level
D:\SAMP\gamemodes\loginommysql.pwn(5081) : warning 219: local variable "string" shadows a variable at a preceding level
D:\SAMP\gamemodes\loginommysql.pwn(5110) : warning 219: local variable "string" shadows a variable at a preceding level
D:\SAMP\gamemodes\loginommysql.pwn(5145) : warning 219: local variable "string" shadows a variable at a preceding level
D:\SAMP\gamemodes\loginommysql.pwn(5221) : warning 219: local variable "string" shadows a variable at a preceding level
D:\SAMP\gamemodes\loginommysql.pwn(5275) : error 021: symbol already defined: "string"
D:\SAMP\gamemodes\loginommysql.pwn(5329) : error 021: symbol already defined: "string"
D:\SAMP\gamemodes\loginommysql.pwn(5394) : warning 219: local variable "string" shadows a variable at a preceding level
etc........
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.


For example: The first dialog is the login,and the third is the dialog,which gives me warning.
http://pastebin.com/7K1FhB6h

Thanks for you help.


Re: local variable "string" shadows a variable - Vykintas - 02.01.2014

Variable defined globally and in function. To fix mistake delete variable "string" definitions in lines 5275
and 5329


Re: local variable "string" shadows a variable - TudvariHUN - 02.01.2014

Then it find's these errors in includes.But I don'T know why did this happen.The string was already there,I only pasted there a lot of other lines,and as a miracle these errors/warnings appeared.


Re: local variable "string" shadows a variable - Vykintas - 02.01.2014

So you don't need help or your errors is anywhere else?


Re: local variable "string" shadows a variable - Natric - 02.01.2014

instead of namming it "string", name it something else such as strings or something, it might work!.


Re: local variable "string" shadows a variable - iZN - 02.01.2014

string, str, tmp are really common string variables, you shouldn't be using them or else it will conflict with includes and libraries. You can always rename them to g_String or something else, or even string_ which is quite easy to change.


Re: local variable "string" shadows a variable - TudvariHUN - 02.01.2014

Got it.thanks.