Update func.cc

Fix for https://github.com/openscad/openscad/issues/322
Added testcase for #322
Support lookup tables with one element, final fix of #322