Arrays / Indexing operators ?

Started by
2 comments, last by LDenninger 19 years, 11 months ago
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 ..?
_-=[ "If there's anything more important than my ego around, I want it caught and shot now." ]=--=[ BeatHarness ]=-=[ Guerrilla Games ]=-=[ KillZone ]=-
Advertisement
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

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

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
_-=[ "If there's anything more important than my ego around, I want it caught and shot now." ]=--=[ BeatHarness ]=-=[ Guerrilla Games ]=-=[ KillZone ]=-
I look forward to seeing your solution

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

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement