Results 1 to 4 of 4

Thread: multi dimensional int array?

  1. #1
    Join Date
    Oct 2011
    Posts
    422
    Mentioned
    15 Post(s)
    Quoted
    116 Post(s)

    Default multi dimensional int array?

    <slushpuppy> hm, why would this throw an error
    <slushpuppy> function param: colorTols : array of array[0..1] of Integer
    <slushpuppy> [[7307392,22],[4011829,22]] <-- how i am calling it
    <slushpuppy> er what data i am passing into it*
    <slushpuppy> it can compile, but running it causes issues
    <slushpuppy> is it possible that the PS interpreter doesn't allow for multidimensional int arrays

    <Mayazcherquoi> slushpuppy: I don't believe you are allowed to set the second dimension of an array like that
    <slushpuppy> eh
    <slushpuppy> i hate these gotchas
    <Mayazcherquoi> Well, not in PascalScript at least i believe.
    I hope someone else can shed some light

  2. #2
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Simba Code:
    function foo():Array of Array of Integer;
    begin
      Result := [[1,3,4,3],[2,3,1],[1243,325,21]];
    end;
    edit:
    Nevermind, this only seems to work in lape.

    edit: edit:
    This is the only way, how ugly.
    Simba Code:
    function foo():Array of Array of Integer;
    begin
      SetLength(Result,3);
      Result[0] := [1,3,4,3];
      Result[1] := [2,3,1];
      Result[2] := [1243,325,21];
    end;
    Last edited by masterBB; 04-30-2012 at 07:43 AM.
    Working on: Tithe Farmer

  3. #3
    Join Date
    Oct 2011
    Posts
    422
    Mentioned
    15 Post(s)
    Quoted
    116 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    Simba Code:
    function foo():Array of Array of Integer;
    begin
      Result := [[1,3,4,3],[2,3,1],[1243,325,21]];
    end;
    edit:
    Nevermind, this only seems to work in lape.

    edit: edit:
    This is the only way, how ugly.
    Simba Code:
    function foo():Array of Array of Integer;
    begin
      SetLength(Result,3);
      Result[0] := [1,3,4,3];
      Result[1] := [2,3,1];
      Result[2] := [1243,325,21];
    end;
    Oh god

  4. #4
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Simba Code:
    var
      arr : array of array of integer;
    begin
      arr := [TIntegerArray([0, 1]), TIntegerArray([2, 3])];
      writeln(arr);
    end.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

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
  •