use get_argument function in callbacks

This commit is contained in:
pantor
2018-02-18 18:56:35 +01:00
parent 693bf63493
commit f931a95800
3 changed files with 16 additions and 12 deletions
+1 -1
View File
@@ -201,7 +201,7 @@ Environment env = Environment();
* - callback function. Implemented with std::function, you can for example use lambdas.
*/
env.add_callback("double", 1, [&env](Parsed::Arguments args, json data) {
const int number = env.renderer.eval_expression<int>(args[0], data); // Adapt the type and index of the argument
int number = env.get_argument<int>(args, 0, data); // Adapt the type and index of the argument
return 2 * number;
});