Arrays / Indexing operators ?
Started by LDenninger, May 17 2004 11:49 AM
3 replies to this topic
#1 Members - Reputation: 122
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 Moderators - Reputation: 2312
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
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
#4 Moderators - Reputation: 2312
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
__________________________________________________________
www.AngelCode.com - game development and more...
AngelScript - free scripting library - Tower - free puzzle game






