added "method_missing" feature
This commit is contained in:
parent
516ca8eec2
commit
c15e0174c9
@ -782,8 +782,20 @@ namespace chaiscript
|
||||
|
||||
Boxed_Value call_function(const std::string &t_name, const std::vector<Boxed_Value> ¶ms) const
|
||||
{
|
||||
try {
|
||||
return dispatch::dispatch(get_function(t_name), params, m_conversions);
|
||||
}
|
||||
catch(chaiscript::exception::dispatch_error&) {
|
||||
auto functions = get_function("method_missing");
|
||||
if (!functions.empty()) {
|
||||
std::vector<Boxed_Value> tmp_params;
|
||||
tmp_params.push_back(var(t_name));
|
||||
tmp_params.insert(tmp_params.end(), params.begin(), params.end());
|
||||
return dispatch::dispatch(functions, tmp_params, m_conversions);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
Boxed_Value call_function(const std::string &t_name) const
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user