Archive 19/01/2023.

AngelScript Dictionary delete problem

devhang

When I try to use Dictionary as the usage of Haspmap (is it right replacement in AS?)
Exists, Set or Get function are work as the document said


but Delete or DeleteAll functions are not working, I find very hard to find the syntax or document for AS, any resources can provide? Thanks!!

Sinoid

They’re bound as:

engine->RegisterObjectMethod("Dictionary", "void Erase(const String &in)", asMETHOD(CScriptDictionary,Delete), asCALL_THISCALL);
engine->RegisterObjectMethod("Dictionary", "void Clear()", asMETHOD(CScriptDictionary,DeleteAll), asCALL_THISCALL);

So it’s Erase(string) and Clear() - they should work.

devhang

Yes, it’s work, thanks for your information, it seems that I cannot totally depend on the class API on the website if I am using AngelScript

Sinoid

Angelscript basic reference is here (still requires referring back to core docs to understand what things actually do):

You can also dump the API from the command-line angelscript compiler, for when you have your own custom stuff bound to AS.

devhang

Thank you for your great information once again :smiley: