Advertisement

Standart array - erase, push_back

Started by August 23, 2008 11:04 AM
4 comments, last by ratatat 16 years, 2 months ago
Hi WitchLord. Can you implement to standart array type 'erase' and 'push_back' methods?
Oh, sorry. I find it in WIP.
Advertisement
If you wish to implement them yourself, it shouldn't be too difficult. You just need to modify the as_arrayobject.cpp file, to add the new methods and register them.

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

static void ArrayObjectPushBack(void *element, asCArrayObject *self){	...}r = engine->RegisterSpecialObjectMethod(asDEFAULT_ARRAY, "void push_back(?????)", asFUNCTION(ArrayObjectPushBack), asCALL_CDECL_OBJLAST); asASSERT( r >= 0 );

????? - how to define the correct type?
Hmm, I believe I've rushed my answer. It is not so easy after all to add this support. The built-in array object is quite tightly integrated with the compiler. Each method on the array object is registered to take a simple reference to an int value, but the compiler knows to pass the correct type to the array object by checking how the variable with the array type has been declared.

I plan on moving the built-in array object out of the engine, and instead create a standard add-on for registering it. When that is done it will be easy to register the needed methods. Unfortunately it will still be a while before I can complete this enhancement.

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

Thanks for your reply, I will wait.

This topic is closed to new replies.

Advertisement