Advertisement

Anonymous objects and initialization lists

Started by June 06, 2014 12:37 PM
1 comment, last by WitchLord 10 years, 5 months ago

As i see in documentation this must work, but i have error.


void foo(dictionary d)
{
}
void foo2()
{
	foo(dictionary = { { "1", 1 }, { "2", 2 }, { "3", 3 } });
}

Output:

INFO : Compiling void foo2().
ERROR : Expected expression value.
ERROR : Instead found '{'.
ERROR : Expected expression value.
ERROR : Instead found ')'.

It's a conflict with the named arguments features that was introduced in this WIP. I'll see if I can resolve this.

In the meantime you can work around it by putting the anynomous object expression between parenthesis, like this:

void foo2()
{
   foo( (dictionary = { { "1", 1 }, { "2", 2 }, { "3", 3 } }) );
}

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

Advertisement

It turns out that it was quite trivial to fix. You can get the fix in revision 1950.

Regards,

Andreas

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