Hi,
I wantto use the dictionary addon.
The problem is this:
The dictionary is using string as a key.
I think I need to have a string representation for every time or every object.
I tried to use the asBEHAVE_VALUE_CAST and asBEHAVE_IMPLICIT_VALUE_CAST. Is this correct? which will allow script to convert that type of object into a string representation.
But when I tried, the script does not call the value cast behaviour, it give me the error msg instead.
One of the example is:
I have my own _string, register as asOBJ_APP_CLASS_CDA | asOBJ_VALUE.
The value cast is register as:
nRet = (asERetCodes) pScriptEngine->RegisterObjectBehaviour("_String", asBEHAVE_VALUE_CAST, "string@ f()", asMETHOD(_String, operator string), asCALL_THISCALL); //asFUNCTION(flexGrid_castScriptObject), asCALL_GENERIC);
assert( nRet >= 0 );
nRet = (asERetCodes) pScriptEngine->RegisterObjectBehaviour("_String", asBEHAVE_IMPLICIT_VALUE_CAST , "string@ f()", asMETHOD(_String, operator string) , asCALL_THISCALL);
assert( nRet >= 0 );
if I used string instead of string@, it will give me error.
when I called: dictionary dict; dict.set(_String("abc"), 100);
it failed. error message is:
ExecuteString (1, 23): Err : No matching signatures to 'dictionary::set(_String &, const uint)'
I believe this means the script does not know how to convert _String into string. isn't it?
Do I do anything wrong here? or any other suggestion?