Jump to content

  • Log In with Google      Sign In   
  • Create Account

- - - - -

arrays anyone


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 leblebi   Members   -  Reputation: 124

Like
Likes
Like

Posted 29 March 2004 - 11:13 AM

Hi everybody. This may sound silly but, how can I use arrays in the scripts? I couldn''t find anything about them. Thanks

Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3444

Like
Likes
Like

Posted 29 March 2004 - 12:53 PM

Not a silly question at all. You didn''t find anything about them because they are not yet supported.

I''m working on a solution for this to come out in the near future. In the meantime you can register objects with methods for accessing array elements.

Example:

struct MyArray
{
void SetLength(int numElements);
element &Item(int index);
int numElements;
element *obj;
};

Where element can be whatever type you want to store. It is not so elegant as native support for arrays, but it is a solution that works.

The reason I haven''t just added the index operator [] for pointers is that I want AngelScript to be secure, using the index operator directly would allow out-of-bounds accessing in scripts and could easily compromise security for both application and operative system.

__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library

#3 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 01 April 2004 - 08:00 AM

How about adding the [] operator as an overloaded one, so the program can do the bounds checking itself?

#4 Andreas Jonsson   Moderators   -  Reputation: 3444

Like
Likes
Like

Posted 01 April 2004 - 08:31 AM

That is already on the list of todos. There is not much missing to add this feature. AngelScript already supports overloading for the dual operators. And adding support for the unary operators is a similar process.

Unfortunately I''m currently very short on time right now. What I was thinking was going to take a couple of days to finish is taking weeks, just because I only get a couple of hours in the weekend to work on AngelScript. This shortage on time will probably last at most until the middle of May if things go as planned.

__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS