implements invokeFunctionForString.