SRL Archive - OSR Help

Compiler glitch.


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:

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

Kasi

2013-11-10 22:34:59

Found your problem….This line…

From: Officer Barbrady
I copied and pasted this exact code from another program


Have you asked anyone else to try it on their system? works completely fine on my system. if you still have no luck just download the latest simba from http://l0.lt/builders/master


program new;
begin
Writeln(Replace('helloworld', 'lo', '10', [rfReplaceAll]));
end.

rj

2013-11-10 22:41:52

From: Kasi
Found your problem….This line…



Have you asked anyone else to try it on their system? works completely fine on my system. if you still have no luck just download the latest simba from http://l0.lt/builders/master


program new;
begin
Writeln(Replace('helloworld', 'lo', '10', [rfReplaceAll]));
end.


Another program on my computer that I made



(even if I comment out the line it selected it gives same error same line thus it is pointing to replace)