Greetings,
i've been working for a while to a program (not game) that revolves around graphs, letting the user modify, create, and save graphs. One functionality i've been working on for some time is scripting support, letting the user write an algorithm in angelscript and see it affect the graph graphically in realtime (for example perform a DFS highlighting the nodes and arcs being visited while the algorithm goes on).
Until now the user could add custom variables to arcs and nodes, and access them through scripts (a simple map string>double). Now i'd like to let the user add variables deciding the type as well, so instead of:
node.add_var("myvariable", 5); //in c++ node.vars["myvariable"] = 5; where node.vars is std::map<std::string, double>
they would specify the type to add and type to get.
However this would start adding exceptions to scripts since variant throws an exception when you get the wrong time, and for something which purpose is easily writing and testing simple algorithms, i'd rather avoid having the user check for exceptions every single time they try to get a variable...
Any ideas? Should i just capture the exception in c++ outside of the angelscript run call, so if the script is using invalid types it's interrupted and the error is reported to the user?