Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

Arrays / Indexing operators ?


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 LDenninger   Members   -  Reputation: 122

Like
Likes
Like

Posted 17 May 2004 - 11:49 AM

I just started using all the nifty operator-stuff, but there''s one thing I could really *really* use : a way to use arrays in script, or in case that''s not possible some way to use indexing-operators so I could create my own array-like-thingie. I know I''ve been bugging Andreas about this for a long time, and I understand the problems this might cause, but still.. it would make my life a whole lot easier Any thoughts / future plans on this ..?

Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3269

Like
Likes
Like

Posted 17 May 2004 - 01:03 PM

Actually the code is pretty much prepared already for adding support for the indexing operator, but alas I don''t have the time to finish it.

Native support for arrays are more complicated, and I will not work on that for a while yet. But I plan to support it one day.

If you (or someone else) are interested in adding the support for the indexing operator yourself maybe I can walk you through it. There should be relatively few things that needs to be done.

1. Add a new flag for the RegisterOperator()
2. Treat the flag
3. Add the [ and ] tokens
4. Add parsing of the indexing operator
5. Compile the indexing operator in CompilePostOperator (Much of the code from CompileFunctionCall() can be reused.)

Until the indexing operator is done, I suggest you register an object method. The actual C++ function used for registering the overloaded [] operator will be the same anyway.

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

#3 LDenninger   Members   -  Reputation: 122

Like
Likes
Like

Posted 18 May 2004 - 11:18 AM

Point taken

I''ve just finished my preliminary array support,
it''s templatized so I just need to call gRegisterArray(engine, "Vertex") (or Vector2, or whatever) and everything should instantly work.

Or so I hope


#4 Andreas Jonsson   Moderators   -  Reputation: 3269

Like
Likes
Like

Posted 18 May 2004 - 02:23 PM

I look forward to seeing your solution

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




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