ResultArray

Share your ZGE-development tips and techniques here!

Moderator: Moderators

Post Reply
User avatar
Kjell
Posts: 1879
Joined: Sat Feb 23, 2008 11:15 pm

ResultArray

Post by Kjell »

:idea:

Let's share some ResultArray tricks.

Code: Select all

int byte4(int P)
{
  return String[P]-48;
}

int byte8(int P)
{
  return byte4(P)*10+
         byte4(P+1);
}

int byteX(int P, int L)
{
  int X = 0;

  for(int B=P; B<P+L; ++B)
  {
    X += byte4(P+L-B-1)*pow(10,B);
  }

  return X;
}

// converts unix timestamp to int

int timestamp()
{
  return byteX(0,10);
}

// converts date("his") to int

int date()
{
  return byte8(0)*3600+
         byte8(2)*60+
         byte8(4);
}
* This message will self destruct as soon as ZGE supports Strings :wink:

K
Post Reply