Results 1 to 3 of 3

Thread: Compiler glitch.

  1. #1
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default Compiler glitch.

    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:

    Simba 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:

    Simba Code:
    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:

    Simba Code:
    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:



    Code:
    Replace(text, find, replace, flags);
    text = tsa[i]
    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:


    Simba Code:
    myBoard.loaded.ITEMS.Add(replace(tsa[i], '.txt', '', [rfReplaceAll]));

    except I changed myBoard to myGUI

  2. #2
    Join Date
    Dec 2007
    Posts
    2,112
    Mentioned
    71 Post(s)
    Quoted
    580 Post(s)

    Default

    Found your problem....This line...

    Quote Originally Posted by Officer Barbrady View Post
    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

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

  3. #3
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Kasi View Post
    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

    Code:
    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)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •