rj
2013-11-10 21:50:12
I have encountered a compiler glitch[PascalScript]… this is not a one of the bugs were it points to the wrong line either.
Alright heres my code:
I'm getting invalid number of parameters at this line:
So… as you can see replace returns a string thus it should have the correct number of parameters. But maybe the replace could have the wrong number? So I broke it down:
Turns out it thinks the replace function has invalid number of parameters (as when I comment it out it compiles)
I don't get it:
Parameters for replace:

text = tsa
find = '.txt'
replace = ''
flags = [rfReplaceAll]
The only reasoning here is that the compiler is glitched. I copied and pasted this exact code from another program:
except I changed myBoard to myGUI
Alright heres my code:
procedure updateFiles;
var
tsa:TStringArray;
i:Integer;
begin
tsa := Getfiles(AppPath + 'dir\', 'txt');
myGUI.loaded.ITEMS.Clear;
for i := 0 to high(tsa) do
myGUI.loaded.ITEMS.Add(replace(tsa[i], '.txt', '', [rfReplaceAll]));
end; I'm getting invalid number of parameters at this line:
myGUI.loaded.ITEMS.Add(replace(tsa[i], '.txt', '', [rfReplaceAll]));So… as you can see replace returns a string thus it should have the correct number of parameters. But maybe the replace could have the wrong number? So I broke it down:
procedure updateFiles;
var
tsa:TStringArray;
i:Integer;
str:String;
begin
tsa := Getfiles(AppPath + 'dir\', 'txt');
myGUI.loaded.ITEMS.Clear;
for i := 0 to high(tsa) do
begin
str := replace(tsa[i], '.txt', '', [rfReplaceAll]);
myGUI.loaded.ITEMS.Add(str);
end;
end; Turns out it thinks the replace function has invalid number of parameters (as when I comment it out it compiles)
I don't get it:
Parameters for replace:

Replace(text, find, replace, flags);text = tsa
find = '.txt'
replace = ''
flags = [rfReplaceAll]
The only reasoning here is that the compiler is glitched. I copied and pasted this exact code from another program:
myBoard.loaded.ITEMS.Add(replace(tsa[i], '.txt', '', [rfReplaceAll]));except I changed myBoard to myGUI
