🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Array of arrays with asEP_DISALLOW_VALUE_ASSIGN_FOR_REF_TYPE not working

Started by
4 comments, last by WitchLord 8 years, 10 months ago

I think this is a bug in the script engine, but maybe I'm doing something wrong. If I use ExecuteString to define an array of arrays, like this (this is my entire script):

array<array<float>> myCircleData;

it works fine. But if I set the engine property:

engine->SetEngineProperty(asEP_DISALLOW_VALUE_ASSIGN_FOR_REF_TYPE, 1);

Then I get the following error in the script:

"The subtype has no default factory","Section":"array","Row":0,"Col":0}
"Can't instantiate template 'array' with subtype 'float[]'","Section":"ExecuteString","Row":2,"Col":7}

If I try to define an array<array<float>> with initialization (as in array<array<float>> myCircleData = { {1.0,1.0} };), I also get these errors.

Is there any way to use arrays of arrays with the Disallow_value-assign_for_ref_type setting? I would really like to use this setting, but I need arrays of arrays.

Thanks,

-Peter

Advertisement

BTW, this is angelscript version 2.29.2 I am using, running in 64-bit Windows using MS Visual Studio 2013.

Thanks,

-Peter

If you use asEP_DISALLOW_VALUE_ASSIGN_FOR_REF_TYPE you're disabling value assignments for reference types, so the correct way of declaring the array of arrays in this case would be as:

array<array<float>@> myCircleData;

That is, an array of handles to arrays of floats.

However, I'll study this further. I might be able to come up with some improvements to make it possible to work even for array<array<float>>.

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, that does seem to work!

It does seem that I cannot initialize my arrays in this case, as in:

array< array<float>@ > myCircleData = { {1,2,3}, {4,5,6} }; // <<= does not work, but would be nice

Thanks for your help.

Best Regards,

-Peter

that might be a bug in the compiler. I'll investigate it.

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

I've finally added the support for the following syntax:

array< array<float>@ > myCircleData = { {1,2,3}, {4,5,6} };

You can find this in revision 2210.

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